summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMikhail Gusarov <dottedmag@dottedmag.net>2010-06-06 15:28:30 +0700
committerMikhail Gusarov <dottedmag@dottedmag.net>2010-06-06 20:27:18 +0700
commit0a4d8cbdcd7b25313fb29ccdb498044af95f7de6 (patch)
tree3534c9035180b7e0d2ebbbf0202a370cb61f8e8d /config
parent5a0fc0ad21d562612676ef88ef2d533b2391810a (diff)
Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch: @@ expression E; @@ -if(E) { free(E); } +free(E); Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'config')
-rw-r--r--config/dbus.c6
-rw-r--r--config/hal.c48
2 files changed, 18 insertions, 36 deletions
diff --git a/config/dbus.c b/config/dbus.c
index 72a0a05dd..4888f621c 100644
--- a/config/dbus.c
+++ b/config/dbus.c
@@ -184,10 +184,8 @@ unwind:
while (options) {
tmpo = options;
options = options->next;
- if (tmpo->key)
- free(tmpo->key);
- if (tmpo->value)
- free(tmpo->value);
+ free(tmpo->key);
+ free(tmpo->value);
free(tmpo);
}
diff --git a/config/hal.c b/config/hal.c
index 6a2232364..5938d4e24 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -251,28 +251,23 @@ device_added(LibHalContext *hal_ctx, const char *udi)
{
if (!strcasecmp(&tmp[3], "layout"))
{
- if (xkb_opts.layout)
- free(xkb_opts.layout);
+ free(xkb_opts.layout);
xkb_opts.layout = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "model"))
{
- if (xkb_opts.model)
- free(xkb_opts.model);
+ free(xkb_opts.model);
xkb_opts.model = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "rules"))
{
- if (xkb_opts.rules)
- free(xkb_opts.rules);
+ free(xkb_opts.rules);
xkb_opts.rules = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "variant"))
{
- if (xkb_opts.variant)
- free(xkb_opts.variant);
+ free(xkb_opts.variant);
xkb_opts.variant = strdup(tmp_val);
} else if (!strcasecmp(&tmp[3], "options"))
{
- if (xkb_opts.options)
- free(xkb_opts.options);
+ free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
} else
@@ -289,8 +284,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
(!strcasecmp(&tmp[3], "options")) &&
(tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
{
- if (xkb_opts.options)
- free(xkb_opts.options);
+ free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
}
@@ -366,22 +360,17 @@ device_added(LibHalContext *hal_ctx, const char *udi)
}
for (; dev; dev = dev->next){
- if (dev->config_info)
- free(dev->config_info);
+ free(dev->config_info);
dev->config_info = xstrdup(config_info);
}
unwind:
if (set)
libhal_free_property_set(set);
- if (path)
- free(path);
- if (driver)
- free(driver);
- if (name)
- free(name);
- if (config_info)
- free(config_info);
+ free(path);
+ free(driver);
+ free(name);
+ free(config_info);
while (!dev && (tmpo = options)) {
options = tmpo->next;
free(tmpo->key);
@@ -401,16 +390,11 @@ unwind:
free(attrs.tags);
}
- if (xkb_opts.layout)
- free(xkb_opts.layout);
- if (xkb_opts.rules)
- free(xkb_opts.rules);
- if (xkb_opts.model)
- free(xkb_opts.model);
- if (xkb_opts.variant)
- free(xkb_opts.variant);
- if (xkb_opts.options)
- free(xkb_opts.options);
+ free(xkb_opts.layout);
+ free(xkb_opts.rules);
+ free(xkb_opts.model);
+ free(xkb_opts.variant);
+ free(xkb_opts.options);
dbus_error_free(&error);