diff options
| author | mbkma <[email protected]> | 2026-03-07 21:50:30 +0100 |
|---|---|---|
| committer | Luke from DC <[email protected]> | 2026-03-22 19:52:54 +0000 |
| commit | 8dcc859c2f7c9b235af0f53b44ba93643a172feb (patch) | |
| tree | da865f20d6d3c40d03dbadd65f37646cee5a329a | |
| parent | 1028b85fb66aea6cdba3f7f5d69ee6c5d727bbc6 (diff) | |
| download | pluma-8dcc859c2f7c9b235af0f53b44ba93643a172feb.tar.bz2 pluma-8dcc859c2f7c9b235af0f53b44ba93643a172feb.tar.xz | |
taglist-plugin: fix free(): invalid pointer
| -rw-r--r-- | plugins/taglist/pluma-taglist-plugin-parser.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/plugins/taglist/pluma-taglist-plugin-parser.c b/plugins/taglist/pluma-taglist-plugin-parser.c index 74693290..d97553b9 100644 --- a/plugins/taglist/pluma-taglist-plugin-parser.c +++ b/plugins/taglist/pluma-taglist-plugin-parser.c @@ -140,7 +140,11 @@ parse_tag_group (TagGroup *tg, const gchar* fn, xmlDocPtr doc, tag = g_new0 (Tag, 1); /* Get Tag name */ - tag->name = (xmlChar*)gettext((const char*)xmlGetProp (cur, (const xmlChar *) "name")); + { + xmlChar *prop = xmlGetProp (cur, (const xmlChar *) "name"); + tag->name = (xmlChar*)g_strdup (gettext ((const char*)prop)); + xmlFree (prop); + } if (tag->name == NULL) { @@ -196,7 +200,11 @@ get_tag_group (const gchar* filename, xmlDocPtr doc, tag_group = g_new0 (TagGroup, 1); /* Get TagGroup name */ - tag_group->name = (xmlChar*)gettext((const char*)xmlGetProp (cur, (const xmlChar *) "name")); + { + xmlChar *prop = xmlGetProp (cur, (const xmlChar *) "name"); + tag_group->name = (xmlChar*)g_strdup (gettext ((const char*)prop)); + xmlFree (prop); + } sort_str = xmlGetProp (cur, (const xmlChar *) "sort"); @@ -499,13 +507,13 @@ free_tag (Tag *tag) */ g_return_if_fail (tag != NULL); - free (tag->name); + g_free (tag->name); if (tag->begin != NULL) - free (tag->begin); + xmlFree (tag->begin); if (tag->end != NULL) - free (tag->end); + xmlFree (tag->end); g_free (tag); } @@ -519,7 +527,7 @@ free_tag_group (TagGroup *tag_group) g_return_if_fail (tag_group != NULL); - free (tag_group->name); + g_free (tag_group->name); for (l = tag_group->tags; l != NULL; l = g_list_next (l)) { |
