summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem.jover@nokia.com>2009-02-21 11:43:15 +0100
committerDanny Kukawka <danny.kukawka@web.de>2009-02-21 11:43:15 +0100
commit92e7f2e8b2a1a36d3ec2b371424719e7078d91da (patch)
tree3eb0cc3be2aeb6538fdf2b6d92f338cf8ce3e7cc
parent0b50c9561267f78ce7af24eaee690e0b4dffb0eb (diff)
do not leak on error conditions
Fixed leaks on error conditions.
-rw-r--r--hald/create_cache.c1
-rw-r--r--hald/device_info.c1
-rw-r--r--hald/linux/addons/addon-hid-ups.c3
-rw-r--r--hald/linux/addons/addon-input.c2
-rw-r--r--libhal/libhal.c4
5 files changed, 9 insertions, 2 deletions
diff --git a/hald/create_cache.c b/hald/create_cache.c
index 232fe981..f2e59176 100644
--- a/hald/create_cache.c
+++ b/hald/create_cache.c
@@ -479,6 +479,7 @@ rules_add_fdi_file (const char *filename, int fd)
parser = XML_ParserCreate (NULL);
if (parser == NULL) {
HAL_ERROR (("Couldn't allocate memory for parser"));
+ g_free (fdi_ctx);
goto out;
}
XML_SetUserData (parser, fdi_ctx);
diff --git a/hald/device_info.c b/hald/device_info.c
index e378a2ed..6444b544 100644
--- a/hald/device_info.c
+++ b/hald/device_info.c
@@ -852,6 +852,7 @@ handle_merge (struct rule *rule, HalDevice *d)
if (d == NULL) {
HAL_ERROR (("Could not find device with udi '%s'", udi_to_merge));
+ g_free (key);
return FALSE;
}
}
diff --git a/hald/linux/addons/addon-hid-ups.c b/hald/linux/addons/addon-hid-ups.c
index 31f38037..b18e1bc4 100644
--- a/hald/linux/addons/addon-hid-ups.c
+++ b/hald/linux/addons/addon-hid-ups.c
@@ -274,7 +274,6 @@ ups_get_static (LibHalContext *ctx, const char *udi, int fd,
dbus_error_init (&error);
libhal_device_commit_changeset (ctx, cs, &error);
- libhal_device_free_changeset (cs);
dbus_error_init (&error);
libhal_device_add_capability (ctx, udi, "battery", &error);
@@ -282,6 +281,8 @@ ups_get_static (LibHalContext *ctx, const char *udi, int fd,
ret = TRUE;
out:
+ libhal_device_free_changeset (cs);
+
return ret;
}
diff --git a/hald/linux/addons/addon-input.c b/hald/linux/addons/addon-input.c
index 5704f826..f6935d32 100644
--- a/hald/linux/addons/addon-input.c
+++ b/hald/linux/addons/addon-input.c
@@ -357,6 +357,7 @@ add_device (LibHalContext *ctx,
if ((device_file = libhal_ps_get_string (properties, "input.device")) == NULL) {
HAL_ERROR(("%s has no property input.device", udi));
+ g_free (data);
return;
}
@@ -369,6 +370,7 @@ add_device (LibHalContext *ctx,
eventfp = open(device_file, O_RDONLY | O_NONBLOCK);
if (!eventfp) {
HAL_ERROR(("Unable to open %s for reading", device_file));
+ g_free (data);
return;
}
diff --git a/libhal/libhal.c b/libhal/libhal.c
index 08c5481e..855b9dc1 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -476,8 +476,10 @@ get_property_set (DBusMessageIter *iter)
p->type = (LibHalPropertyType) dbus_message_iter_get_arg_type (&var_iter);
- if(!libhal_property_fill_value_from_variant (p, &var_iter))
+ if (!libhal_property_fill_value_from_variant (p, &var_iter)) {
+ free (p);
goto oom;
+ }
HASH_ADD_KEYPTR (hh, result->properties, p->key, strlen (p->key), p);