summaryrefslogtreecommitdiffstats
path: root/sys-utils/lscpu.c
diff options
context:
space:
mode:
authorKarel Zak2017-03-31 11:05:26 +0200
committerKarel Zak2017-03-31 11:05:26 +0200
commitc6f6afc164df1396435a8a8181e97a92e12f1d89 (patch)
tree66ae1b920933fd2e710a5218a345cbca38c603f4 /sys-utils/lscpu.c
parentlscpu: check return code [coverity scan] (diff)
downloadkernel-qcow2-util-linux-c6f6afc164df1396435a8a8181e97a92e12f1d89.tar.gz
kernel-qcow2-util-linux-c6f6afc164df1396435a8a8181e97a92e12f1d89.tar.xz
kernel-qcow2-util-linux-c6f6afc164df1396435a8a8181e97a92e12f1d89.zip
lscpu: fix mem leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/lscpu.c')
-rw-r--r--sys-utils/lscpu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index bc449dac5..7da441edd 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1052,12 +1052,15 @@ read_hypervisor(struct lscpu_desc *desc, struct lscpu_modifier *mod)
fclose(fd);
if (val) {
+ char *org = val;
+
while (isdigit(*val))
++val;
if (!*val) {
desc->hyper = HYPER_VSERVER;
desc->virtype = VIRT_CONT;
}
+ free(org);
}
}
}
@@ -1719,7 +1722,7 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
for (i = 0; i < ncols; i++) {
data = get_cell_header(desc, cols[i], mod, buf, sizeof(buf));
- if (!scols_table_new_column(table, xstrdup(data), 0, 0))
+ if (!scols_table_new_column(table, data, 0, 0))
err(EXIT_FAILURE, _("failed to initialize output column"));
}