gst/gstvalue.c: fix a leak if no flags are set
authorThomas Vander Stichele <thomas@apestaart.org>
Wed, 10 May 2006 15:38:53 +0000 (15:38 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Wed, 10 May 2006 15:38:53 +0000 (15:38 +0000)
Original commit message from CVS:

* gst/gstvalue.c: (gst_value_serialize_flags):
fix a leak if no flags are set
* tests/check/gst/gstvalue.c: (GST_START_TEST):
fix leak in tests

ChangeLog
gst/gstvalue.c
tests/check/gst/gstvalue.c

index 41f9fff..bb1e97b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-10  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+       * gst/gstvalue.c: (gst_value_serialize_flags):
+         fix a leak if no flags are set
+       * tests/check/gst/gstvalue.c: (GST_START_TEST):
+         fix leak in tests
+
 2006-05-10  Tim-Philipp Müller  <tim at centricular dot net>
 
        * docs/manual/basics-pads.xml:
index deb9a32..5016c55 100644 (file)
@@ -1919,7 +1919,6 @@ gst_value_serialize_flags (const GValue * value)
 
   g_return_val_if_fail (klass, NULL);
 
-  result = g_strdup ("");
   flags = g_value_get_flags (value);
 
   /* if no flags are set, try to serialize to the _NONE string */
@@ -1929,6 +1928,7 @@ gst_value_serialize_flags (const GValue * value)
   }
 
   /* some flags are set, so serialize one by one */
+  result = g_strdup ("");
   while (flags) {
     fl = gst_flags_get_first_value (klass, flags);
     if (fl != NULL) {
index 066abd7..0d520a7 100644 (file)
@@ -345,6 +345,7 @@ GST_START_TEST (test_serialize_flags)
     fail_if (string == NULL, "could not serialize flags %d", i);
     fail_unless (strcmp (string, results[i]) == 0,
         "resulting value is %s, not %s, for flags #%d", string, results[i], i);
+    g_free (string);
   }
 }