mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gst/gstregistryxml.c: Fix memory leak I introduced a few days ago.
Original commit message from CVS: * gst/gstregistryxml.c: Fix memory leak I introduced a few days ago.
This commit is contained in:
parent
aacc87e07c
commit
e216a00ca9
2 changed files with 23 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2007-09-26 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/gstregistryxml.c:
|
||||||
|
Fix memory leak I introduced a few days ago.
|
||||||
|
|
||||||
2007-09-26 Michael Smith <msmith@fluendo.com>
|
2007-09-26 Michael Smith <msmith@fluendo.com>
|
||||||
|
|
||||||
* gst/gstbuffer.c: (gst_buffer_finalize):
|
* gst/gstbuffer.c: (gst_buffer_finalize):
|
||||||
|
|
|
@ -132,6 +132,20 @@ read_string (xmlTextReaderPtr reader, gchar ** write_to, gboolean allow_blank)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
read_const_interned_string (xmlTextReaderPtr reader, const gchar ** write_to,
|
||||||
|
gboolean allow_blank)
|
||||||
|
{
|
||||||
|
gchar *s = NULL;
|
||||||
|
|
||||||
|
if (!read_string (reader, &s, allow_blank))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
*write_to = g_intern_string (s);
|
||||||
|
g_free (s);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
read_uint (xmlTextReaderPtr reader, guint * write_to)
|
read_uint (xmlTextReaderPtr reader, guint * write_to)
|
||||||
{
|
{
|
||||||
|
@ -200,7 +214,8 @@ load_pad_template (xmlTextReaderPtr reader)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int depth = xmlTextReaderDepth (reader);
|
int depth = xmlTextReaderDepth (reader);
|
||||||
gchar *name = NULL, *caps_str = NULL;
|
const gchar *name = NULL;
|
||||||
|
gchar *caps_str = NULL;
|
||||||
guint direction = 0, presence = 0;
|
guint direction = 0, presence = 0;
|
||||||
|
|
||||||
while ((ret = xmlTextReaderRead (reader)) == 1) {
|
while ((ret = xmlTextReaderRead (reader)) == 1) {
|
||||||
|
@ -208,7 +223,7 @@ load_pad_template (xmlTextReaderPtr reader)
|
||||||
GstStaticPadTemplate *template;
|
GstStaticPadTemplate *template;
|
||||||
|
|
||||||
template = g_new0 (GstStaticPadTemplate, 1);
|
template = g_new0 (GstStaticPadTemplate, 1);
|
||||||
template->name_template = g_intern_string (name);
|
template->name_template = name; /* must be an interned string! */
|
||||||
template->presence = presence;
|
template->presence = presence;
|
||||||
template->direction = direction;
|
template->direction = direction;
|
||||||
template->static_caps.string = caps_str;
|
template->static_caps.string = caps_str;
|
||||||
|
@ -220,7 +235,7 @@ load_pad_template (xmlTextReaderPtr reader)
|
||||||
const gchar *tag = (gchar *) xmlTextReaderConstName (reader);
|
const gchar *tag = (gchar *) xmlTextReaderConstName (reader);
|
||||||
|
|
||||||
if (g_str_equal (tag, "nametemplate")) {
|
if (g_str_equal (tag, "nametemplate")) {
|
||||||
read_string (reader, &name, FALSE);
|
read_const_interned_string (reader, &name, FALSE);
|
||||||
} else if (g_str_equal (tag, "direction")) {
|
} else if (g_str_equal (tag, "direction")) {
|
||||||
read_enum (reader, GST_TYPE_PAD_DIRECTION, &direction);
|
read_enum (reader, GST_TYPE_PAD_DIRECTION, &direction);
|
||||||
} else if (g_str_equal (tag, "presence")) {
|
} else if (g_str_equal (tag, "presence")) {
|
||||||
|
@ -230,7 +245,6 @@ load_pad_template (xmlTextReaderPtr reader)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_free (name);
|
|
||||||
g_free (caps_str);
|
g_free (caps_str);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue