registrychunks: Initialize typefind/element factory registry chunks with zeroes
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 9 Apr 2010 11:08:13 +0000 (13:08 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Fri, 9 Apr 2010 11:08:13 +0000 (13:08 +0200)
This makes valgrind stop complaining about reading unitializated memory,
which is not initialized because it's just compiler-added struct padding...

gst/gstregistrychunks.c

index 32a7cfb..018e59e 100644 (file)
@@ -231,7 +231,10 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
     GstRegistryChunkElementFactory *ef;
     GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
 
-    ef = g_slice_new (GstRegistryChunkElementFactory);
+    /* Initialize with zeroes because of struct padding and
+     * valgrind complaining about copying unitialized memory
+     */
+    ef = g_slice_new0 (GstRegistryChunkElementFactory);
     chk =
         gst_registry_chunks_make_data (ef,
         sizeof (GstRegistryChunkElementFactory));
@@ -291,7 +294,10 @@ gst_registry_chunks_save_feature (GList ** list, GstPluginFeature * feature)
     GstTypeFindFactory *factory = GST_TYPE_FIND_FACTORY (feature);
     gchar *str;
 
-    tff = g_slice_new (GstRegistryChunkTypeFindFactory);
+    /* Initialize with zeroes because of struct padding and
+     * valgrind complaining about copying unitialized memory
+     */
+    tff = g_slice_new0 (GstRegistryChunkTypeFindFactory);
     chk =
         gst_registry_chunks_make_data (tff,
         sizeof (GstRegistryChunkTypeFindFactory));