From 46b7217fbf02b679749cf1d042ecc57504a3b97c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 15 May 2014 10:15:26 +0100 Subject: [PATCH] =?utf8?q?gtestutils:=20Don=E2=80=99t=20free=20unassigned?= =?utf8?q?=20variables=20in=20an=20error=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If the stream is invalid, msg.nums and msg.strings have not been assigned to, so don’t free them. Coverity issue: #1159505 --- glib/gtestutils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glib/gtestutils.c b/glib/gtestutils.c index 002c2ae..88a6fc0 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -3057,9 +3057,11 @@ g_test_log_extract (GTestLogBuffer *tbuffer) tbuffer->msgs = g_slist_prepend (tbuffer->msgs, g_memdup (&msg, sizeof (msg))); return TRUE; } + + g_free (msg.nums); + g_strfreev (msg.strings); } - g_free (msg.nums); - g_strfreev (msg.strings); + g_error ("corrupt log stream from test program"); return FALSE; } -- 2.7.4