summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-04-17 12:42:23 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2014-04-17 12:42:23 +0900
commit274c4f21a56bc90e2c5666192c40c69c414d8ac7 (patch)
tree8486667137d83fa1d62a0df8a73572cdf41d041b
parentca128d1eee6599263b5e43b087781a00ada2732c (diff)
Fix leak in ibus_get_local_machine_id()
If /var/lib/dbus/machine-id does not exist but /etc/machine-id exists, 'error' will be set but will never be freed. BUG=http://code.google.com/p/ibus/issues/detail?id=1701 Review URL: https://codereview.appspot.com/88770043 Patch from Christophe Fergeau <cfergeau@redhat.com>.
-rw-r--r--src/ibusshare.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ibusshare.c b/src/ibusshare.c
index d36232d0..c4a72441 100644
--- a/src/ibusshare.c
+++ b/src/ibusshare.c
@@ -50,12 +50,14 @@ ibus_get_local_machine_id (void)
NULL,
NULL)) {
g_warning ("Unable to load /var/lib/dbus/machine-id: %s", error->message);
- g_error_free (error);
machine_id = "machine-id";
}
else {
g_strstrip (machine_id);
}
+ if (error != NULL) {
+ g_error_free (error);
+ }
}
return machine_id;