[PATCH 01/10] linux: fix memleak when reading critical action

Peter Wu peter at lekensteyn.nl
Wed Nov 26 03:21:08 PST 2014


g_variant_get for string types must be freed as documented at
https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-strings
Since we just want to compare it, use a pointer as documented at
https://developer.gnome.org/glib/stable/gvariant-format-strings.html#gvariant-format-strings-pointers

https://bugs.freedesktop.org/show_bug.cgi?id=82659
---
 src/linux/up-backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c
index f588e74..f45ce29 100644
--- a/src/linux/up-backend.c
+++ b/src/linux/up-backend.c
@@ -346,7 +346,7 @@ check_action_result (GVariant *result)
 	if (result) {
 		const char *s;
 
-		g_variant_get (result, "(s)", &s);
+		g_variant_get (result, "(&s)", &s);
 		if (g_strcmp0 (s, "yes") == 0)
 			return TRUE;
 	}
-- 
2.1.3



More information about the devkit-devel mailing list