mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-03 20:22:38 +00:00
Fix some memleaks reported by Coverity
This commit is contained in:
parent
7fe01ac2ce
commit
014a28e9cf
@ -363,7 +363,7 @@ static int core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth
|
||||
if (ref->addr != UT64_MAX) {
|
||||
switch (ref->type) {
|
||||
case 'd':
|
||||
iscodesection (core, ref->at);
|
||||
// XXX UNUSED iscodesection (core, ref->at);
|
||||
break;
|
||||
case R_ANAL_REF_TYPE_CODE:
|
||||
case R_ANAL_REF_TYPE_CALL:
|
||||
@ -438,23 +438,30 @@ R_API RAnalOp* r_core_anal_op(RCore *core, ut64 addr) {
|
||||
ut8 *ptr;
|
||||
RAsmOp asmop;
|
||||
|
||||
op = R_NEW0(RAnalOp);
|
||||
op = R_NEW0 (RAnalOp);
|
||||
if (!op) return NULL;
|
||||
|
||||
if (addr >= core->offset && addr + 16 < core->offset + core->blocksize) {
|
||||
int delta = (addr - core->offset);
|
||||
ptr = core->block + delta;
|
||||
len = core->blocksize - delta;
|
||||
if (len<1) {
|
||||
free (op);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
ut8 buf[128];
|
||||
|
||||
if (r_io_read_at (core->io, addr, buf, sizeof (buf)) < 1)
|
||||
if (r_io_read_at (core->io, addr, buf, sizeof (buf)) < 1) {
|
||||
free (op);
|
||||
return NULL;
|
||||
}
|
||||
ptr = buf;
|
||||
len = sizeof (buf);
|
||||
}
|
||||
if (r_anal_op (core->anal, op, addr, ptr, len) < 1)
|
||||
if (r_anal_op (core->anal, op, addr, ptr, len) < 1) {
|
||||
free (op);
|
||||
return NULL;
|
||||
}
|
||||
// decode instruction here
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
if (r_asm_disassemble (core->assembler, &asmop, ptr, len) > 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user