[pygobject] Fix a couple of memory leaks in the tests
- From: Patrick Griffis <pgriffis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix a couple of memory leaks in the tests
- Date: Mon, 23 Aug 2021 16:15:45 +0000 (UTC)
commit 945d91245503c50c2137132b5e9ab2277065eae7
Author: David King <amigadave amigadave com>
Date: Wed Jul 14 10:37:16 2021 +0100
Fix a couple of memory leaks in the tests
Found by Coverity.
https://bugzilla.redhat.com/show_bug.cgi?id=1938851
tests/testhelpermodule.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index e6f6ffe4..eb17af87 100644
--- a/tests/testhelpermodule.c
+++ b/tests/testhelpermodule.c
@@ -362,11 +362,12 @@ test_paramspec_callback (GObject *object)
static GValue *
test_gvalue_callback (GObject *object, const GValue *v)
{
- GValue *ret = g_malloc0 (sizeof (GValue));
+ GValue *ret;
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
g_return_val_if_fail (G_IS_VALUE (v), NULL);
+ ret = g_malloc0 (sizeof (GValue));
g_value_init (ret, G_VALUE_TYPE (v));
g_value_copy (v, ret);
return ret;
@@ -375,10 +376,11 @@ test_gvalue_callback (GObject *object, const GValue *v)
static GValue *
test_gvalue_ret_callback (GObject *object, GType type)
{
- GValue *ret = g_malloc0 (sizeof (GValue));
+ GValue *ret;
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
+ ret = g_malloc0 (sizeof (GValue));
g_value_init (ret, type);
switch (type) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]