[tip:x86/urgent] x86/boot-image: Don't leak phdrs in arch/x86/boot/compressed/misc.c::Parse_elf()

From: tip-bot for Jesper Juhl
Date: Thu Jan 26 2012 - 08:39:57 EST


Commit-ID: 5067cf53cac9b36d42ebb3a45bb12259d0bc1e68
Gitweb: http://git.kernel.org/tip/5067cf53cac9b36d42ebb3a45bb12259d0bc1e68
Author: Jesper Juhl <jj@xxxxxxxxxxxxx>
AuthorDate: Mon, 23 Jan 2012 23:34:59 +0100
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Thu, 26 Jan 2012 11:30:29 +0100

x86/boot-image: Don't leak phdrs in arch/x86/boot/compressed/misc.c::Parse_elf()

We allocate memory with malloc(), but neglect to free it before
the variable 'phdrs' goes out of scope --> leak.

Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>
Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1201232332590.8772@xxxxxxxxxxxxxxxxxxxxxxxxx
[ Mostly harmless. ]
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
arch/x86/boot/compressed/misc.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 3a19d04..7116dcb 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -321,6 +321,8 @@ static void parse_elf(void *output)
default: /* Ignore other PT_* */ break;
}
}
+
+ free(phdrs);
}

asmlinkage void decompress_kernel(void *rmode, memptr heap,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/