summaryrefslogtreecommitdiff
path: root/src/locale/localectl.c
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2012-10-26 14:16:18 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-10-28 02:14:41 +0200
commit7ca7021a9e0c443d40d0af5e9a7e1962d8032229 (patch)
treef0ed6276bc755373ea70660a5d55b349de5dced6 /src/locale/localectl.c
parent2f7a4867babd3fd382e5495f21724358f30fa67d (diff)
localectl: fix memleak, use _cleanup_strv_free_
l might contain zero strings, however there is still memory allocated for NULL terminator, use _cleanup_strv_free_ instead to prevent tiny leak in such case.
Diffstat (limited to 'src/locale/localectl.c')
-rw-r--r--src/locale/localectl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 84feb25d52..7d3ac0ad2f 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -483,7 +483,8 @@ static int nftw_cb(
}
static int list_vconsole_keymaps(DBusConnection *bus, char **args, unsigned n) {
- char **l, **i;
+ char _cleanup_strv_free_ **l = NULL;
+ char **i;
keymaps = set_new(string_hash_func, string_compare_func);
if (!keymaps)
@@ -513,7 +514,6 @@ static int list_vconsole_keymaps(DBusConnection *bus, char **args, unsigned n) {
STRV_FOREACH(i, l)
puts(*i);
- strv_free(l);
return 0;
}