Fix a NULL dereference

This commit is contained in:
Álvaro Felipe Melchor 2015-05-21 21:30:28 +02:00 committed by pancake
parent 6b5460c6a4
commit 29e8668e51
2 changed files with 6 additions and 4 deletions

View File

@ -110,15 +110,16 @@ R_API void r_anal_ex_clone_op_switch_to_bb (RAnalBlock *bb, RAnalOp *op) {
RListIter *iter;
RAnalCaseOp *caseop = NULL;
if ( op->switch_op ) {
if (op->switch_op) {
bb->switch_op = r_anal_switch_op_new (op->switch_op->addr,
op->switch_op->min_val,
op->switch_op->max_val);
r_list_foreach (op->switch_op->cases, iter, caseop) {
r_anal_switch_op_add_case (bb->switch_op, caseop->addr,
if (bb->switch_op){
r_list_foreach (op->switch_op->cases, iter, caseop) {
r_anal_switch_op_add_case (bb->switch_op, caseop->addr,
caseop->value, caseop->jump);
}
}
}
}

View File

@ -3,6 +3,7 @@
RAnalSwitchOp *switch_op_new() {
RAnalSwitchOp * swop = R_NEW0 (RAnalSwitchOp);
if (!swop) return NULL;
swop->cases = r_list_new ();
swop->cases->free = (void *)free;
swop->min_val = swop->def_val = swop->max_val = 0;