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
This commit is contained in:
Vineeth TM 2015-10-05 11:12:47 +09:00 committed by Sebastian Dröge
parent 3e8ef4cf5a
commit 456ef2aa1d
2 changed files with 5 additions and 0 deletions

View file

@ -373,9 +373,13 @@ GST_START_TEST (test_buffer_tags)
gst_sample_unref (s2); gst_sample_unref (s2);
fail_if (gst_tag_list_get_sample_index (tags, GST_TAG_IMAGE, 1, &s1)); 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)); 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)); 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)); 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_IMAGE, 0, &s1));
fail_if (!gst_tag_list_get_sample_index (tags, GST_TAG_PREVIEW_IMAGE, 0, fail_if (!gst_tag_list_get_sample_index (tags, GST_TAG_PREVIEW_IMAGE, 0,

View 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_warning ("Couldn't fetch sample for %s tag", tag);
g_assert_not_reached (); g_assert_not_reached ();
} }
gst_sample_unref (sample);
} else if (gst_tag_get_type (tag) == GST_TYPE_DATE_TIME) { } else if (gst_tag_get_type (tag) == GST_TYPE_DATE_TIME) {
GstDateTime *dt = NULL; GstDateTime *dt = NULL;