1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

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.
This commit is contained in:
Michal Sekletar 2012-10-26 14:16:18 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 2f7a4867ba
commit 7ca7021a9e

View File

@ -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;
}