From b6e69ba6fc71b0383b253149f0dd37489c6cbda8 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 7 Jul 2013 20:54:30 +0100 Subject: [PATCH] lscpu: fix memory leak [clang-analyzer] Signed-off-by: Sami Kerola --- sys-utils/lscpu-dmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c index 21e024bc41..8f02779d6e 100644 --- a/sys-utils/lscpu-dmi.c +++ b/sys-utils/lscpu-dmi.c @@ -130,8 +130,10 @@ static int hypervisor_from_dmi_table(uint32_t base, uint16_t len, * is invalid, but we cannot reliably locate the next entry. * Better stop at this point. */ - if (h.length < 4) + if (h.length < 4) { + free(data); return HYPER_NONE; + } /* look for the next handle */ next = data + h.length; -- 2.47.2