From 1fcaf8918f2d6b564f31cd35a4d2cc4448f60c83 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 21 Oct 2014 13:07:02 +0200 Subject: [PATCH] tests/padmonitor: Correcly strdup the result of get_metadata. The const pointer was becoming invalid after the first call to add_metadata, and we ended up setting corrupted data on the second call. --- validate/tests/check/validate/padmonitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/validate/tests/check/validate/padmonitor.c b/validate/tests/check/validate/padmonitor.c index 969da10001..d4090c2398 100644 --- a/validate/tests/check/validate/padmonitor.c +++ b/validate/tests/check/validate/padmonitor.c @@ -95,7 +95,7 @@ GST_START_TEST (buffer_outside_segment) GstBuffer *buffer; GstSegment segment; GstElement *src, *sink; - const gchar *fakesrc_klass; + gchar *fakesrc_klass; GstValidateReport *report; GstValidateRunner *runner; GstValidateMonitor *monitor; @@ -106,7 +106,7 @@ GST_START_TEST (buffer_outside_segment) sink = gst_element_factory_make ("fakesink", "fakesink"); fakesrc_klass = - gst_element_class_get_metadata (GST_ELEMENT_GET_CLASS (src), "klass"); + g_strdup (gst_element_class_get_metadata (GST_ELEMENT_GET_CLASS (src), "klass")); /* Testing if a buffer is outside a segment is only done for buffer outputed * from decoders for the moment, fake a Decoder so that the test is properly @@ -134,7 +134,6 @@ GST_START_TEST (buffer_outside_segment) gst_event_new_stream_start ("the-stream"))); fail_unless (gst_pad_push_event (srcpad, gst_event_new_segment (&segment))); - /* Pushing a buffer that is outside the segment */ { buffer = gst_buffer_new (); @@ -166,6 +165,7 @@ GST_START_TEST (buffer_outside_segment) gst_element_class_add_metadata (GST_ELEMENT_GET_CLASS (src), "klass", fakesrc_klass); + g_free (fakesrc_klass); gst_object_unref (src); gst_object_unref (runner);