[glib: 1/3] gtestutils: Fix a minor memory leak




commit b639687b60fb0bd1e2addfa960c3532bf3ebf2a3
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Aug 18 09:33:06 2020 +0100

    gtestutils: Fix a minor memory leak
    
    Coverity CID: #1430603
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/gtestutils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/glib/gtestutils.c b/glib/gtestutils.c
index 8ca995cac..3b03e9831 100644
--- a/glib/gtestutils.c
+++ b/glib/gtestutils.c
@@ -1530,7 +1530,10 @@ void
 
           test_prgname = g_path_get_basename (g_get_prgname ());
           if (*test_prgname == '\0')
-            test_prgname = g_strdup ("unknown");
+            {
+              g_free (test_prgname);
+              test_prgname = g_strdup ("unknown");
+            }
           tmpl = g_strdup_printf ("test_%s_XXXXXX", test_prgname);
           g_free (test_prgname);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]