fix memleaks - #150001

Original commit message from CVS:
fix memleaks - #150001
This commit is contained in:
Thomas Vander Stichele 2004-08-17 09:16:42 +00:00
parent fa2bc96eaa
commit 38ca60f6fe
5 changed files with 25 additions and 3 deletions

View file

@ -1,3 +1,13 @@
2004-08-17 Thomas Vander Stichele <thomas at apestaart dot org>
patch by: Luca Ognibene <skaboy81@virgilio.it>
* gst/gstcaps.c:
* gst/gstelement.c:
* gst/gstpad.c:
* gst/gstxml.c:
fix memleaks. Fixes #150001
2004-08-17 Benjamin Otte <in7y118@public.uni-hamburg.de> 2004-08-17 Benjamin Otte <in7y118@public.uni-hamburg.de>
* docs/random/ds/0.9-suggested-changes: * docs/random/ds/0.9-suggested-changes:

View file

@ -976,8 +976,10 @@ gst_caps_subtract (const GstCaps * minuend, const GstCaps * subtrahend)
gst_caps_append_structure (dest, gst_structure_copy (min)); gst_caps_append_structure (dest, gst_structure_copy (min));
} }
} }
if (gst_caps_is_empty (dest)) if (gst_caps_is_empty (dest)) {
gst_caps_free (src);
return dest; return dest;
}
} }
gst_caps_free (src); gst_caps_free (src);

View file

@ -3220,6 +3220,8 @@ gst_element_restore_thyself (GstObject * object, xmlNodePtr self)
/* FIXME: can this just be g_object_set ? */ /* FIXME: can this just be g_object_set ? */
gst_util_set_object_arg (G_OBJECT (element), name, value); gst_util_set_object_arg (G_OBJECT (element), name, value);
/* g_object_set (G_OBJECT (element), name, value, NULL); */ /* g_object_set (G_OBJECT (element), name, value, NULL); */
g_free (name);
g_free (value);
} }
children = children->next; children = children->next;
} }

View file

@ -3002,11 +3002,13 @@ gst_pad_load_and_link (xmlNodePtr self, GstObject * parent)
gchar **split; gchar **split;
GstElement *target; GstElement *target;
GstObject *grandparent; GstObject *grandparent;
gchar *name = NULL;
while (field) { while (field) {
if (!strcmp (field->name, "name")) { if (!strcmp (field->name, "name")) {
pad = gst_element_get_pad (GST_ELEMENT (parent), name = xmlNodeGetContent (field);
xmlNodeGetContent (field)); pad = gst_element_get_pad (GST_ELEMENT (parent), name);
g_free (name);
} else if (!strcmp (field->name, "peer")) { } else if (!strcmp (field->name, "peer")) {
peer = xmlNodeGetContent (field); peer = xmlNodeGetContent (field);
} }
@ -3023,8 +3025,11 @@ gst_pad_load_and_link (xmlNodePtr self, GstObject * parent)
GST_CAT_DEBUG (GST_CAT_XML, GST_CAT_DEBUG (GST_CAT_XML,
"Could not parse peer '%s' for pad %s:%s, leaving unlinked", "Could not parse peer '%s' for pad %s:%s, leaving unlinked",
peer, GST_DEBUG_PAD_NAME (pad)); peer, GST_DEBUG_PAD_NAME (pad));
g_free (peer);
return; return;
} }
g_free (peer);
g_return_if_fail (split[0] != NULL); g_return_if_fail (split[0] != NULL);
g_return_if_fail (split[1] != NULL); g_return_if_fail (split[1] != NULL);

View file

@ -415,6 +415,9 @@ gst_xml_make_element (xmlNodePtr cur, GstObject * parent)
g_return_val_if_fail (element != NULL, NULL); g_return_val_if_fail (element != NULL, NULL);
g_free (type);
g_free (name);
/* ne need to set the parent on this object bacause the pads */ /* ne need to set the parent on this object bacause the pads */
/* will go through the hierarchy to link to their peers */ /* will go through the hierarchy to link to their peers */
if (parent) if (parent)