summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorRuediger Meier2016-03-16 13:18:19 +0100
committerKarel Zak2016-03-16 14:17:34 +0100
commite5fc6d6fb57c1fb22b6dcff584639ade37ad8b9b (patch)
treeae2a9005a3f4818b796f50d205337f478efc50c3 /sys-utils/lscpu.c
parentlscpu: use cpu and revision tag if available (diff)
downloadkernel-qcow2-util-linux-e5fc6d6fb57c1fb22b6dcff584639ade37ad8b9b.tar.gz
kernel-qcow2-util-linux-e5fc6d6fb57c1fb22b6dcff584639ade37ad8b9b.tar.xz
kernel-qcow2-util-linux-e5fc6d6fb57c1fb22b6dcff584639ade37ad8b9b.zip
lscpu: fix memleak because of ambiguous tags
Now the first one of certain ambiguous tags wins. Alternatively to this patch we could have called free() before xstrdup(). Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 3b338aac9..36e36c9ef 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -353,7 +353,8 @@ lookup(char *line, char *pattern, char **value)
char *p, *v;
int len = strlen(pattern);
- if (!*line)
+ /* don't re-fill already found tags, first one wins */
+ if (!*line || *value)
return 0;
/* pattern */