From: Edward Hervey Date: Mon, 24 Nov 2008 11:56:44 +0000 (+0000) Subject: plugins/elements/gstfilesrc.c: Fix memory leak. X-Git-Tag: GIT_CONVERSION~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa1dfbb00449684c8cc53f083dc5ab5124a354e8;p=platform%2Fupstream%2Fgstreamer.git plugins/elements/gstfilesrc.c: Fix memory leak. Original commit message from CVS: * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): Fix memory leak. --- diff --git a/ChangeLog b/ChangeLog index f3bc8ff..bcc14cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-11-24 Edward Hervey + + * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): + Fix memory leak. + 2008-11-24 Sebastian Dröge Patch by: Simon Holm Thøgersen diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index d9bc699..2d2ec41 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -1101,7 +1101,7 @@ static gboolean gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) { gchar *location, *hostname = NULL; - gboolean ret; + gboolean ret = FALSE; GstFileSrc *src = GST_FILE_SRC (handler); if (strcmp (uri, "file://") == 0) { @@ -1116,17 +1116,13 @@ gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) if (!location) { GST_WARNING_OBJECT (src, "Invalid URI '%s' for filesrc", uri); - return FALSE; + goto beach; } - if (hostname) { - if (strcmp (hostname, "localhost")) { - /* Only 'localhost' is permitted */ - GST_WARNING_OBJECT (src, "Invalid hostname '%s' for filesrc", hostname); - g_free (hostname); - return FALSE; - } - g_free (hostname); + if ((hostname) && (strcmp (hostname, "localhost"))) { + /* Only 'localhost' is permitted */ + GST_WARNING_OBJECT (src, "Invalid hostname '%s' for filesrc", hostname); + goto beach; } #ifdef G_OS_WIN32 /* Unfortunately, g_filename_from_uri() doesn't handle some UNC paths @@ -1139,7 +1135,12 @@ gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) #endif ret = gst_file_src_set_location (src, location); - g_free (location); + +beach: + if (location) + g_free (location); + if (hostname) + g_free (hostname); return ret; }