chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2f7a486
)
localectl: fix memleak, use _cleanup_strv_free_
author
Michal Sekletar
<msekleta@redhat.com>
Fri, 26 Oct 2012 12:16:18 +0000
(14:16 +0200)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Sun, 28 Oct 2012 00:14:41 +0000
(
02:14
+0200)
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.
src/locale/localectl.c
patch
|
blob
|
history
diff --git
a/src/locale/localectl.c
b/src/locale/localectl.c
index 84feb25d521d0a6d612436b34a12dfc5f30f1e3b..7d3ac0ad2fe52dd437b518d367ef1a0375b56a93 100644
(file)
--- 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;
}