When setting the content using a type different from the original (src
content instead of text content, for example), set the old content to
NULL after releasing its memory. Otherwise, we try to free them when
releasing the content object or setting the content again.
if (content->src)
g_free (content->src);
if (content->content)
if (content->src)
g_free (content->src);
if (content->content)
- g_free (content->content);
+ {
+ g_free (content->content);
+ content->content = NULL;
+ }
- xmlFreeNode (content->xmlcontent);
+ {
+ xmlFreeNode (content->xmlcontent);
+ content->xmlcontent = NULL;
+ }
content->src = g_strdup (src);
}
content->src = g_strdup (src);
}
if (content->content)
g_free (content->content);
if (content->src)
if (content->content)
g_free (content->content);
if (content->src)
+ {
+ g_free (content->src);
+ content->src = NULL;
+ }
- xmlFreeNode (content->xmlcontent);
+ {
+ xmlFreeNode (content->xmlcontent);
+ content->xmlcontent = NULL;
+ }
content->content = g_malloc (len);
memcpy (content->content, buffer, len);
}
content->content = g_malloc (len);
memcpy (content->content, buffer, len);
}
if (content->xmlcontent)
xmlFreeNode (content->xmlcontent);
if (content->content)
if (content->xmlcontent)
xmlFreeNode (content->xmlcontent);
if (content->content)
- g_free (content->content);
+ {
+ g_free (content->content);
+ content->content = NULL;
+ }
+ {
+ g_free (content->src);
+ content->src = NULL;
+ }
content->xmlcontent = xmlCopyNodeList (node);
}
content->xmlcontent = xmlCopyNodeList (node);
}