girepository: Fix leak in prefix_with_context

Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938731
This commit is contained in:
David King 2021-05-20 12:48:34 +01:00 committed by Emmanuele Bassi
parent 3ebf2f5140
commit 18745a0639

View File

@ -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);