gst/gstregistryxml.c: Strings allocated by libxml2 should be freed with xmlFree(), not with g_free(). Fixes issues on...

Original commit message from CVS:
Patch by: Fabrizio Gennari <fabrizio.ge at tiscali it>
* gst/gstregistryxml.c: (read_string), (load_feature):
Strings allocated by libxml2 should be freed with xmlFree(), not
with g_free(). Fixes issues on windows in certain contexts (#519698).
This commit is contained in:
Fabrizio Gennari 2008-03-01 11:21:30 +00:00 committed by Tim-Philipp Müller
parent 97bf2d2d78
commit 96aa08f008
2 changed files with 20 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2008-03-01 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Fabrizio Gennari <fabrizio.ge at tiscali it>
* gst/gstregistryxml.c: (read_string), (load_feature):
Strings allocated by libxml2 should be freed with xmlFree(), not
with g_free(). Fixes issues on windows in certain contexts (#519698).
2008-02-29 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstinterface.c: (gst_element_implements_interface):

View file

@ -123,9 +123,15 @@ read_string (xmlTextReaderPtr reader, gchar ** write_to, gboolean allow_blank)
return found;
}
if (xmlTextReaderNodeType (reader) == XML_READER_TYPE_TEXT) {
xmlChar *value;
if (found)
return FALSE;
*write_to = (gchar *) xmlTextReaderValue (reader);
value = xmlTextReaderValue (reader);
*write_to = g_strdup ((gchar *) value);
xmlFree (value);
found = TRUE;
}
}
@ -255,21 +261,20 @@ load_feature (xmlTextReaderPtr reader)
{
int ret;
int depth;
gchar *feature_name;
xmlChar *feature_name;
GstPluginFeature *feature;
GType type;
depth = xmlTextReaderDepth (reader);
feature_name =
(gchar *) xmlTextReaderGetAttribute (reader, BAD_CAST "typename");
feature_name = xmlTextReaderGetAttribute (reader, BAD_CAST "typename");
GST_LOG ("loading feature");
GST_LOG ("loading feature '%s'", GST_STR_NULL ((const char *) feature_name));
if (!feature_name)
return NULL;
type = g_type_from_name (feature_name);
g_free (feature_name);
type = g_type_from_name ((const char *) feature_name);
xmlFree (feature_name);
feature_name = NULL;
if (!type) {