diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-22 06:39:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-22 06:39:58 -0400 |
commit | b8d389e8f30eaed04dcd56bb9007e49df7d37c2e (patch) | |
tree | 07f9ec6de6f6ba5d282e02fc478dfe85ceb57088 /tools | |
parent | b5ac3beb5a9f0ef0ea64cd85faf94c0dc4de0e42 (diff) | |
parent | b703798386fb7288d5a995bd2284a984a5e24f3c (diff) |
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull objtool fix from Thomas Gleixner:
"Plug a memory leak in the instruction decoder"
* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
objtool: Fix memory leak in decode_instructions()
Diffstat (limited to 'tools')
-rw-r--r-- | tools/objtool/check.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index a0c518ecf085..c0e26ad1fa7e 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -267,12 +267,13 @@ static int decode_instructions(struct objtool_file *file) &insn->immediate, &insn->stack_op); if (ret) - return ret; + goto err; if (!insn->type || insn->type > INSN_LAST) { WARN_FUNC("invalid instruction type %d", insn->sec, insn->offset, insn->type); - return -1; + ret = -1; + goto err; } hash_add(file->insn_hash, &insn->hash, insn->offset); @@ -296,6 +297,10 @@ static int decode_instructions(struct objtool_file *file) } return 0; + +err: + free(insn); + return ret; } /* |