From 456ef2aa1d912a8af5283907d2ffb8ca51481c2a Mon Sep 17 00:00:00 2001 From: Vineeth TM Date: Mon, 5 Oct 2015 11:12:47 +0900 Subject: [PATCH] tests/gst-launch: Fix sample memory leak 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 | 4 ++++ tools/gst-launch.c | 1 + 2 files changed, 5 insertions(+) diff --git a/tests/check/gst/gsttag.c b/tests/check/gst/gsttag.c index 7a5e5ca..75c84da 100644 --- a/tests/check/gst/gsttag.c +++ b/tests/check/gst/gsttag.c @@ -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, diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 839bd64..a522a5b 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -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; -- 2.7.4