tests/gst-launch: Fix sample memory leak
authorVineeth TM <vineeth.tm@samsung.com>
Mon, 5 Oct 2015 02:12:47 +0000 (11:12 +0900)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 7 Oct 2015 18:04:04 +0000 (19:04 +0100)
When sample is got using gst_tag_list_get_sample_index, it should
be free'd.

https://bugzilla.gnome.org/show_bug.cgi?id=756069

tests/check/gst/gsttag.c
tools/gst-launch.c

index 7a5e5ca..75c84da 100644 (file)
@@ -373,9 +373,13 @@ GST_START_TEST (test_buffer_tags)
   gst_sample_unref (s2);
 
   fail_if (gst_tag_list_get_sample_index (tags, GST_TAG_IMAGE, 1, &s1));
+  gst_sample_unref (s1);
   fail_if (gst_tag_list_get_sample_index (tags, GST_TAG_IMAGE, 2, &s1));
+  gst_sample_unref (s1);
   fail_if (gst_tag_list_get_sample_index (tags, GST_TAG_PREVIEW_IMAGE, 1, &s1));
+  gst_sample_unref (s1);
   fail_if (gst_tag_list_get_sample_index (tags, GST_TAG_PREVIEW_IMAGE, 2, &s1));
+  gst_sample_unref (s1);
 
   fail_if (!gst_tag_list_get_sample_index (tags, GST_TAG_IMAGE, 0, &s1));
   fail_if (!gst_tag_list_get_sample_index (tags, GST_TAG_PREVIEW_IMAGE, 0,
index afbb333..7d80f57 100644 (file)
@@ -371,6 +371,7 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
         g_warning ("Couldn't fetch sample for %s tag", tag);
         g_assert_not_reached ();
       }
+      gst_sample_unref (sample);
     } else if (gst_tag_get_type (tag) == GST_TYPE_DATE_TIME) {
       GstDateTime *dt = NULL;