Fix few clang-analyzer warnings (#12415)

This commit is contained in:
dav1901 2018-12-06 16:12:27 +02:00 committed by radare
parent 64f2e25c3a
commit 3b03e923f5
7 changed files with 11 additions and 8 deletions

View File

@ -59,7 +59,7 @@ static void r_anal_ex_perform_pre_anal_bb_cb(RAnal *anal, RAnalState *state, ut6
}*/
static void r_anal_ex_perform_post_anal_op_cb(RAnal *anal, RAnalState *state, ut64 addr) {
if (anal->cur && anal->cur->post_anal_op_cb) {
if (anal && anal->cur && anal->cur->post_anal_op_cb) {
anal->cur->post_anal_op_cb (anal, state, addr);
}
}

View File

@ -229,7 +229,7 @@ static FcnTreeIter _fcn_tree_iter_first(RBNode *x_, ut64 from, ut64 to) {
static void _fcn_tree_iter_next(FcnTreeIter *it, ut64 from, ut64 to) {
RBNode *x_ = it->cur, *y_;
RAnalFunction *x = FCN_CONTAINER (x_), *y;
RAnalFunction *x, *y;
for (;;) {
if ((y_ = x_->child[1]) && (y = FCN_CONTAINER (y_), from <= y->rb_max_addr)) {
it->cur = _fcn_tree_probe (it, y_, from, to);

View File

@ -42,7 +42,7 @@ static void cmd_project_init(RCore *core) {
static int cmd_project(void *data, const char *input) {
RCore *core = (RCore *) data;
const char *file, *arg = (input && *input)? input + 1: NULL;
const char *file, *arg;
const char *fileproject = r_config_get (core->config, "prj.name");
char *str = NULL;

View File

@ -1058,8 +1058,8 @@ static int cmd_type(void *data, const char *input) {
ut8 code[128] = { 0 };
(void)r_io_read_at (core->io, core->offset, code, sizeof (code));
r_asm_set_pc (core->assembler, addr);
int ret = r_asm_disassemble (core->assembler, &asmop, code, core->blocksize);
ret = r_anal_op (core->anal, &op, core->offset, code, core->blocksize, R_ANAL_OP_MASK_VAL);
(void)r_asm_disassemble (core->assembler, &asmop, code, core->blocksize);
int ret = r_anal_op (core->anal, &op, core->offset, code, core->blocksize, R_ANAL_OP_MASK_VAL);
if (ret >= 0) {
// HACK: Just convert only the first imm seen
for (i = 0; i < 3; i++) {

View File

@ -878,7 +878,7 @@ static int cmd_write(void *data, const char *input) {
if (len > 0){
ut64 cur_off = core->offset;
cmd_suc = r_core_extend_at (core, addr, len);
cmd_suc = r_core_seek (core, cur_off, 1);
r_core_seek (core, cur_off, 1);
core->offset = addr;
r_core_block_read (core);
}

View File

@ -1717,8 +1717,8 @@ void backedge_info (RAGraph *g) {
}
for (j = 0; j < g->layers[i].n_nodes; j++) {
RANode *a = (RANode *)g->layers[i].nodes[j]->data;
if (a->is_dummy) {
RANode *a = get_anode (g->layers[i].nodes[j]);
if (!a || a->is_dummy) {
continue;
}

View File

@ -294,6 +294,9 @@ static char *rap__system(RIO *io, RIODesc *fd, const char *command) {
buf[0] |= RMT_REPLY;
memset (buf + 1, 0, 4);
ret = r_socket_read_block (s, buf + 1, 4);
if (ret != 4) {
return NULL;
}
cmdlen = r_read_at_be32 (buf, 1);
if (cmdlen + 1 == 0) { // check overflow
cmdlen = 0;