summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid King <dking@redhat.com>2021-05-20 12:48:34 +0100
committerEmmanuele Bassi <ebassi@gmail.com>2021-06-18 14:28:05 +0000
commit4dcc1b3536d0e9f12d510b8489771e72a9ca7282 (patch)
tree11e6df9c576067ee1472e426227d8f1317578ebc
parentf3b8d2771dc9689a3e8a9f1a34337992946d7a84 (diff)
downloadgobject-introspection-4dcc1b3536d0e9f12d510b8489771e72a9ca7282.tar.gz
girepository: Fix leak in prefix_with_context
Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731
-rw-r--r--girepository/gitypelib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index de11748b..904dff45 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -2139,7 +2139,7 @@ prefix_with_context (GError **error,
const char *section,
ValidateContext *ctx)
{
- GString *str = g_string_new (NULL);
+ GString *str;
GSList *link;
char *buf;
@@ -2150,6 +2150,8 @@ prefix_with_context (GError **error,
return;
}
+ str = g_string_new (NULL);
+
for (; link; link = link->next)
{
g_string_append (str, link->data);