]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: fix memory leak [clang-analyzer]
authorSami Kerola <kerolasa@iki.fi>
Sun, 7 Jul 2013 19:54:30 +0000 (20:54 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Jul 2013 12:25:05 +0000 (14:25 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/lscpu-dmi.c

index 21e024bc41d69fc95792aa4d3ca4bb8ca1e1e600..8f02779d6e7f2cad0ccba2e54d3d0a0b3f531083 100644 (file)
@@ -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;