Allocate everything that is written to the registry with g_malloc0()

Allocate every structure that is directly written to the binary
registry with g_malloc0(). Otherwise some parts of it will be
uninitialized (struct padding because of alignment, etc) and
valgrind will complain about it.
This commit is contained in:
Sebastian Dröge 2009-01-30 10:29:56 +01:00
parent c44ca96bee
commit 1af5d201fc

View file

@ -404,7 +404,7 @@ gst_registry_binary_save_pad_template (GList ** list,
GstBinaryPadTemplate *pt; GstBinaryPadTemplate *pt;
GstBinaryChunk *chk; GstBinaryChunk *chk;
pt = g_malloc (sizeof (GstBinaryPadTemplate)); pt = g_malloc0 (sizeof (GstBinaryPadTemplate));
chk = gst_registry_binary_make_data (pt, sizeof (GstBinaryPadTemplate)); chk = gst_registry_binary_make_data (pt, sizeof (GstBinaryPadTemplate));
pt->presence = template->presence; pt->presence = template->presence;
@ -445,7 +445,7 @@ gst_registry_binary_save_feature (GList ** list, GstPluginFeature * feature)
GstBinaryElementFactory *ef; GstBinaryElementFactory *ef;
GstElementFactory *factory = GST_ELEMENT_FACTORY (feature); GstElementFactory *factory = GST_ELEMENT_FACTORY (feature);
ef = g_malloc (sizeof (GstBinaryElementFactory)); ef = g_malloc0 (sizeof (GstBinaryElementFactory));
chk = gst_registry_binary_make_data (ef, sizeof (GstBinaryElementFactory)); chk = gst_registry_binary_make_data (ef, sizeof (GstBinaryElementFactory));
ef->npadtemplates = ef->ninterfaces = ef->nuriprotocols = 0; ef->npadtemplates = ef->ninterfaces = ef->nuriprotocols = 0;
pf = (GstBinaryPluginFeature *) ef; pf = (GstBinaryPluginFeature *) ef;
@ -505,7 +505,7 @@ gst_registry_binary_save_feature (GList ** list, GstPluginFeature * feature)
* faster when loading them later on */ * faster when loading them later on */
GstCaps *copy = gst_caps_copy (factory->caps); GstCaps *copy = gst_caps_copy (factory->caps);
tff = g_malloc (sizeof (GstBinaryTypeFindFactory)); tff = g_malloc0 (sizeof (GstBinaryTypeFindFactory));
chk = chk =
gst_registry_binary_make_data (tff, sizeof (GstBinaryTypeFindFactory)); gst_registry_binary_make_data (tff, sizeof (GstBinaryTypeFindFactory));
tff->nextensions = 0; tff->nextensions = 0;
@ -526,7 +526,7 @@ gst_registry_binary_save_feature (GList ** list, GstPluginFeature * feature)
} else if (GST_IS_INDEX_FACTORY (feature)) { } else if (GST_IS_INDEX_FACTORY (feature)) {
GstIndexFactory *factory = GST_INDEX_FACTORY (feature); GstIndexFactory *factory = GST_INDEX_FACTORY (feature);
pf = g_malloc (sizeof (GstBinaryPluginFeature)); pf = g_malloc0 (sizeof (GstBinaryPluginFeature));
chk = gst_registry_binary_make_data (pf, sizeof (GstBinaryPluginFeature)); chk = gst_registry_binary_make_data (pf, sizeof (GstBinaryPluginFeature));
pf->rank = feature->rank; pf->rank = feature->rank;
@ -602,7 +602,7 @@ gst_registry_binary_save_plugin (GList ** list, GstRegistry * registry,
GList *plugin_features = NULL; GList *plugin_features = NULL;
GList *walk; GList *walk;
pe = g_malloc (sizeof (GstBinaryPluginElement)); pe = g_malloc0 (sizeof (GstBinaryPluginElement));
chk = gst_registry_binary_make_data (pe, sizeof (GstBinaryPluginElement)); chk = gst_registry_binary_make_data (pe, sizeof (GstBinaryPluginElement));
pe->file_size = plugin->file_size; pe->file_size = plugin->file_size;