rtsprange: don't leak the range in case of parsing error.
authorStefan Kost <ensonic@users.sf.net>
Thu, 26 Feb 2009 15:38:47 +0000 (17:38 +0200)
committerStefan Kost <ensonic@users.sf.net>
Thu, 26 Feb 2009 16:01:05 +0000 (18:01 +0200)
Free the gstRTSPTimeRange if we don't return it. Also simplify
gst_rtsp_range_free() as it is valid to pass NULL to g_free().

gst-libs/gst/rtsp/gstrtsprange.c

index cad31f8..ceb5258 100644 (file)
@@ -167,9 +167,10 @@ gst_rtsp_range_parse (const gchar * rangestr, GstRTSPTimeRange ** range)
   } else
     goto invalid;
 
-  if (ret == GST_RTSP_OK)
-    *range = res;
+  if (ret != GST_RTSP_OK)
+    goto invalid;
 
+  *range = res;
   return ret;
 
   /* ERRORS */
@@ -271,8 +272,5 @@ gst_rtsp_range_to_string (const GstRTSPTimeRange * range)
 void
 gst_rtsp_range_free (GstRTSPTimeRange * range)
 {
-  if (range == NULL)
-    return;
-
   g_free (range);
 }