benchmarks: Fix potential stack corruption in capsnego test
authorNirbheek Chauhan <nirbheek@centricular.com>
Mon, 11 Jul 2016 13:15:49 +0000 (18:45 +0530)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 11 Jul 2016 13:18:21 +0000 (14:18 +0100)
flavour_str is a non-const pointer that will be written to if the -f
option is passed

tests/benchmarks/capsnego.c

index dc60194..5a7a390 100644 (file)
@@ -185,7 +185,7 @@ gint
 main (gint argc, gchar * argv[])
 {
   /* default parameters */
-  const gchar *flavour_str = "audio";
+  gchar *flavour_str = g_strdup("audio");
   gint flavour = FLAVOUR_AUDIO;
   gint children = 3;
   gint depth = 4;
@@ -230,6 +230,8 @@ main (gint argc, gchar * argv[])
   /* build pipeline */
   g_print ("building %s pipeline with depth = %d and children = %d\n",
       flavour_str, depth, children);
+  g_free (flavour_str);
+
   start = gst_util_get_timestamp ();
   bin = GST_BIN (gst_pipeline_new ("pipeline"));
   sink = gst_element_factory_make ("fakesink", NULL);