diff --git a/libr/anal/anal.c b/libr/anal/anal.c index f7bec93a00..a8848635b9 100644 --- a/libr/anal/anal.c +++ b/libr/anal/anal.c @@ -254,7 +254,10 @@ R_API RAnalOp *r_anal_op_hexstr(RAnal *anal, ut64 addr, const char *str) { RAnalOp *op = R_NEW0 (RAnalOp); if (!op) return NULL; buf = malloc (strlen (str)+1); - if (!buf) return NULL; + if (!buf) { + free (op); + return NULL; + } len = r_hex_str2bin (str, buf); r_anal_op (anal, op, addr, buf, len); return op;