mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 12:15:19 +00:00
Fix memory leaks:
Original commit message from CVS: reviewed by: David Schleef <ds@schleef.org> Fix memory leaks: * gst/gstcaps.c: (gst_caps_to_string): * gst/registries/gstxmlregistry.c: (gst_xml_registry_add_path_list_func), (gst_xml_registry_parse_padtemplate):
This commit is contained in:
parent
031bcfd561
commit
30bec331af
3 changed files with 28 additions and 9 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2004-02-02 Jon Trowbridge <trow@gnu.org>
|
||||||
|
|
||||||
|
reviewed by: David Schleef <ds@schleef.org>
|
||||||
|
|
||||||
|
Fix memory leaks:
|
||||||
|
* gst/gstcaps.c: (gst_caps_to_string):
|
||||||
|
* gst/registries/gstxmlregistry.c:
|
||||||
|
(gst_xml_registry_add_path_list_func),
|
||||||
|
(gst_xml_registry_parse_padtemplate):
|
||||||
|
|
||||||
2004-02-02 Thomas Vander Stichele <thomas at apestaart dot org>
|
2004-02-02 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* gst/gstelement.c: (gst_element_default_error):
|
* gst/gstelement.c: (gst_element_default_error):
|
||||||
|
|
|
@ -1026,6 +1026,7 @@ gchar *gst_caps_to_string (const GstCaps *caps)
|
||||||
int i;
|
int i;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GString *s;
|
GString *s;
|
||||||
|
char *sstr;
|
||||||
|
|
||||||
/* NOTE: This function is potentially called by the debug system,
|
/* NOTE: This function is potentially called by the debug system,
|
||||||
* so any calls to gst_log() (and GST_DEBUG(), GST_LOG(), etc.)
|
* so any calls to gst_log() (and GST_DEBUG(), GST_LOG(), etc.)
|
||||||
|
@ -1046,13 +1047,17 @@ gchar *gst_caps_to_string (const GstCaps *caps)
|
||||||
}
|
}
|
||||||
s = g_string_new("");
|
s = g_string_new("");
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
g_string_append(s, gst_structure_to_string(structure));
|
sstr = gst_structure_to_string(structure);
|
||||||
|
g_string_append(s, sstr);
|
||||||
|
g_free(sstr);
|
||||||
|
|
||||||
for(i=1;i<caps->structs->len;i++){
|
for(i=1;i<caps->structs->len;i++){
|
||||||
structure = gst_caps_get_structure (caps, i);
|
structure = gst_caps_get_structure (caps, i);
|
||||||
|
|
||||||
g_string_append(s, "; ");
|
g_string_append(s, "; ");
|
||||||
g_string_append(s, gst_structure_to_string(structure));
|
sstr = gst_structure_to_string(structure);
|
||||||
|
g_string_append(s, sstr);
|
||||||
|
g_free(sstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_string_free(s, FALSE);
|
return g_string_free(s, FALSE);
|
||||||
|
|
|
@ -375,9 +375,9 @@ gst_xml_registry_get_perms_func (GstXMLRegistry *registry)
|
||||||
static void
|
static void
|
||||||
gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
|
gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
|
||||||
{
|
{
|
||||||
FILE *reg;
|
FILE *reg = NULL;
|
||||||
GMarkupParseContext *context;
|
GMarkupParseContext *context;
|
||||||
gchar *text;
|
gchar *text = NULL;
|
||||||
gssize size;
|
gssize size;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
|
||||||
registry, NULL);
|
registry, NULL);
|
||||||
|
|
||||||
if (! (reg = fopen (registry->location, "r"))) {
|
if (! (reg = fopen (registry->location, "r"))) {
|
||||||
return;
|
goto finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* slightly allocate more as gmarkup reads too much */
|
/* slightly allocate more as gmarkup reads too much */
|
||||||
|
@ -399,9 +399,7 @@ gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
|
||||||
if (error) {
|
if (error) {
|
||||||
GST_ERROR ("parsing registry %s: %s\n",
|
GST_ERROR ("parsing registry %s: %s\n",
|
||||||
registry->location, error->message);
|
registry->location, error->message);
|
||||||
g_free (text);
|
goto finished;
|
||||||
fclose (reg);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (registry->state == GST_XML_REGISTRY_PATHS_DONE)
|
if (registry->state == GST_XML_REGISTRY_PATHS_DONE)
|
||||||
|
@ -410,7 +408,12 @@ gst_xml_registry_add_path_list_func (GstXMLRegistry *registry)
|
||||||
size = fread (text, 1, BLOCK_SIZE, reg);
|
size = fread (text, 1, BLOCK_SIZE, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (reg);
|
finished:
|
||||||
|
|
||||||
|
g_markup_parse_context_free (context);
|
||||||
|
|
||||||
|
if (reg)
|
||||||
|
fclose (reg);
|
||||||
|
|
||||||
g_free (text);
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
@ -837,6 +840,7 @@ gst_xml_registry_parse_padtemplate (GMarkupParseContext *context, const gchar *t
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = g_strndup (text, text_len);
|
s = g_strndup (text, text_len);
|
||||||
|
g_assert (registry->caps == NULL);
|
||||||
registry->caps = gst_caps_from_string (s);
|
registry->caps = gst_caps_from_string (s);
|
||||||
if (registry->caps == NULL) {
|
if (registry->caps == NULL) {
|
||||||
g_critical ("Could not parse caps: length %d, content: %*s\n", text_len, text_len, text);
|
g_critical ("Could not parse caps: length %d, content: %*s\n", text_len, text_len, text);
|
||||||
|
|
Loading…
Reference in a new issue