[glib: 1/2] gobject/tests/performance: fix leaks




commit a5d551e2bed40db1385db562e2a89b5c16ac6970
Author: Marc-André Lureau <marcandre lureau redhat com>
Date:   Thu Jun 23 17:15:47 2022 +0400

    gobject/tests/performance: fix leaks
    
    Easily spotted by ASAN.
    
    Signed-off-by: Marc-André Lureau <marcandre lureau redhat com>

 gobject/tests/performance/performance-threaded.c | 1 +
 gobject/tests/performance/performance.c          | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gobject/tests/performance/performance-threaded.c 
b/gobject/tests/performance/performance-threaded.c
index 7e6ebc5eb3..4107553f26 100644
--- a/gobject/tests/performance/performance-threaded.c
+++ b/gobject/tests/performance/performance-threaded.c
@@ -372,5 +372,6 @@ main (int   argc,
        run_test (&tests[i]);
     }
 
+  g_option_context_free (context);
   return 0;
 }
diff --git a/gobject/tests/performance/performance.c b/gobject/tests/performance/performance.c
index 937509d8dd..e2d0b1abd5 100644
--- a/gobject/tests/performance/performance.c
+++ b/gobject/tests/performance/performance.c
@@ -479,7 +479,7 @@ test_construction_init (PerformanceTest *test,
   if (data->n_objects != n)
     {
       data->n_objects = n;
-      data->objects = g_new (GObject *, n);
+      data->objects = g_renew (GObject *, data->objects, n);
     }
 }
 
@@ -603,7 +603,7 @@ test_finalization_init (PerformanceTest *test,
   if (data->n_objects != n)
     {
       data->n_objects = n;
-      data->objects = g_new (GObject *, n);
+      data->objects = g_renew (GObject *, data->objects, n);
     }
 
   for (int i = 0; i <  data->n_objects; i++)
@@ -1219,5 +1219,6 @@ main (int   argc,
         run_test (&tests[k]);
     }
 
+  g_option_context_free (context);
   return 0;
 }


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