gst: Fix string leak when G_VALUE_COLLECT_INIT() was failed
authorSeungha Yang <seungha.yang@navercorp.com>
Tue, 11 Dec 2018 11:12:41 +0000 (20:12 +0900)
committerSeungha Yang <seungha.yang@navercorp.com>
Mon, 12 Nov 2018 11:12:41 +0000 (20:12 +0900)
Returned string should be freed

Fixes #319

gst/gstcaps.c
gst/gstchildproxy.c
gst/gststructure.c
gst/gsttracerrecord.c

index 01f8934..0d01951 100644 (file)
@@ -1049,6 +1049,7 @@ gst_caps_set_simple_valist (GstCaps * caps, const char *field, va_list varargs)
     G_VALUE_COLLECT_INIT (&value, type, varargs, 0, &err);
     if (G_UNLIKELY (err)) {
       g_critical ("%s", err);
+      g_free (err);
       return;
     }
 
index 1bf983a..22c5d1a 100644 (file)
@@ -452,6 +452,7 @@ cant_copy:
         (GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""), error);
     g_value_unset (&value);
     g_object_unref (target);
+    g_free (error);
     return;
   }
 }
index b6f3d2e..d9b1dcf 100644 (file)
@@ -631,6 +631,7 @@ gst_structure_set_valist_internal (GstStructure * structure,
     G_VALUE_COLLECT_INIT (&field.value, type, varargs, 0, &err);
     if (G_UNLIKELY (err)) {
       g_critical ("%s", err);
+      g_free (err);
       return;
     }
     gst_structure_set_field (structure, &field);
@@ -697,6 +698,7 @@ gst_structure_id_set_valist_internal (GstStructure * structure,
     G_VALUE_COLLECT_INIT (&field.value, type, varargs, 0, &err);
     if (G_UNLIKELY (err)) {
       g_critical ("%s", err);
+      g_free (err);
       return;
     }
     gst_structure_set_field (structure, &field);
index 2446a6e..639a4cc 100644 (file)
@@ -208,6 +208,7 @@ gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...)
     G_VALUE_COLLECT_INIT (&val, type, varargs, G_VALUE_NOCOPY_CONTENTS, &err);
     if (G_UNLIKELY (err)) {
       g_critical ("%s", err);
+      g_free (err);
       break;
     }
     /* see boxed_proxy_collect_value */