From 4dcc1b3536d0e9f12d510b8489771e72a9ca7282 Mon Sep 17 00:00:00 2001 From: David King Date: Thu, 20 May 2021 12:48:34 +0100 Subject: girepository: Fix leak in prefix_with_context Found by Coverity. https://bugzilla.redhat.com/show_bug.cgi?id=1938731 --- girepository/gitypelib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- cgit v1.2.1