提交 b8d389e8 编写于 作者: L Linus Torvalds

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()
...@@ -267,12 +267,13 @@ static int decode_instructions(struct objtool_file *file) ...@@ -267,12 +267,13 @@ static int decode_instructions(struct objtool_file *file)
&insn->immediate, &insn->immediate,
&insn->stack_op); &insn->stack_op);
if (ret) if (ret)
return ret; goto err;
if (!insn->type || insn->type > INSN_LAST) { if (!insn->type || insn->type > INSN_LAST) {
WARN_FUNC("invalid instruction type %d", WARN_FUNC("invalid instruction type %d",
insn->sec, insn->offset, insn->type); insn->sec, insn->offset, insn->type);
return -1; ret = -1;
goto err;
} }
hash_add(file->insn_hash, &insn->hash, insn->offset); hash_add(file->insn_hash, &insn->hash, insn->offset);
...@@ -296,6 +297,10 @@ static int decode_instructions(struct objtool_file *file) ...@@ -296,6 +297,10 @@ static int decode_instructions(struct objtool_file *file)
} }
return 0; return 0;
err:
free(insn);
return ret;
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册