binaryregistry: don't crash in cleaning up on error.
authorStefan Kost <ensonic@users.sf.net>
Fri, 11 Sep 2009 18:20:57 +0000 (21:20 +0300)
committerStefan Kost <ensonic@users.sf.net>
Fri, 11 Sep 2009 18:20:57 +0000 (21:20 +0300)
Don't dereference NULL pointers.

gst/gstregistrybinary.c

index 09c6ae3..661685e 100644 (file)
@@ -794,9 +794,11 @@ fail_free_list:
     for (walk = to_write; walk; walk = g_list_next (walk)) {
       GstBinaryChunk *cur = walk->data;
 
-      if (!(cur->flags & GST_BINARY_REGISTRY_FLAG_CONST))
-        g_free (cur->data);
-      g_free (cur);
+      if (cur) {
+        if (!(cur->flags & GST_BINARY_REGISTRY_FLAG_CONST))
+          g_free (cur->data);
+        g_free (cur);
+      }
     }
     g_list_free (to_write);