--- rtmpsink.memoryleak/gstrtmpsink.c	2012-08-08 17:30:17.000000000 +0200
+++ rtmpsink/gstrtmpsink.c	2012-08-08 17:40:38.000000000 +0200
@@ -293,6 +293,7 @@
     GError ** error)
 {
   GstRTMPSink *sink = GST_RTMP_SINK (handler);
+  gboolean rv = TRUE;
 
   if (GST_STATE (sink) >= GST_STATE_PAUSED) {
     g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_STATE,
@@ -315,14 +316,20 @@
           ("Failed to parse URI %s", uri), (NULL));
       g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
           "Could not parse RTMP URI");
-      return FALSE;
+      rv = FALSE;
     }
-    sink->uri = g_strdup (uri);
+    else {
+      sink->uri = g_strdup (uri);
+    }
+
+    if (playpath.av_val)
+      g_free (playpath.av_val);
   }
 
-  GST_DEBUG_OBJECT (sink, "Changed URI to %s", GST_STR_NULL (uri));
+  if (rv)
+    GST_DEBUG_OBJECT (sink, "Changed URI to %s", GST_STR_NULL (uri));
 
-  return TRUE;
+  return rv;
 }
 
 static void
