From 2f309be848421a23f67dac9bffb19f0dc8e0e2b0 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Fri, 6 Mar 2015 10:47:45 -0800 Subject: [PATCH] Initialize 'gva' to NULL in up_device_get_history_sync If everything goes as planned, The GVariant 'gva' is initialized by the call to up_device_glue_call_get_history_sync. If that call fails, however (e.g. if the device has no history), the pointer can be left uninitialized and result in a crash when the function later tries to use g_variant_unref on it. Signed-off-by: Jason Gerecke --- libupower-glib/up-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 9f6e0e1..b64a5dc 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -422,7 +422,7 @@ GPtrArray * up_device_get_history_sync (UpDevice *device, const gchar *type, guint timespec, guint resolution, GCancellable *cancellable, GError **error) { GError *error_local = NULL; - GVariant *gva; + GVariant *gva = NULL; guint i; GPtrArray *array = NULL; gboolean ret; -- 2.3.0