Fix few clang warnings (#12394)

This commit is contained in:
dav1901 2018-12-04 15:19:30 +02:00 committed by radare
parent bbebd7ed86
commit 3ca357b182
3 changed files with 6 additions and 8 deletions

View File

@ -77,7 +77,9 @@ static bool load(RBinFile *bf) {
}
load_bytes (bf, &bf->o->bin_obj, bytes, sz, bf->o->loadaddr, bf->sdb);
if (!bf->o || !bf->o->bin_obj) {
MACH0_(mach0_free) (bf->o->bin_obj);
if (bf->o) {
MACH0_(mach0_free) (bf->o->bin_obj);
}
return false;
}
struct MACH0_(obj_t) *mo = bf->o->bin_obj;

View File

@ -814,7 +814,7 @@ static int cmd_type(void *data, const char *input) {
ls_free (l);
} else { // "tej ENUM"
RListIter *iter;
RTypeEnum *member = R_NEW0 (RTypeEnum);
RTypeEnum *member;
if (member_name) {
res = r_type_enum_member (TDB, name, NULL, r_num_math (core->num, member_name));
// NEVER REACHED

View File

@ -1099,7 +1099,6 @@ repeat:
int maxcount = 9;
int rows, cols = r_cons_get_size (&rows);
idx = 0;
count = 0;
char *dis = NULL;
rows -= 4;
@ -2312,7 +2311,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
cur = core->print->cur - 1;
}
snprintf (buf, sizeof (buf), "%s @ $$0!%i", p,
core->blocksize - core->print->cur);
core->blocksize - cur);
r_core_cmd (core, buf, 0);
free (p);
break;
@ -2422,7 +2421,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
break;
case 'G':
ret = 0;
ret = -1;
int scols = r_config_get_i (core->config, "hex.cols");
if (core->file) {
if (core->io->va) {
@ -2442,8 +2441,6 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
r_io_fd_size (core->io, core->file->fd)
- core->blocksize + 2 * scols, 1);
}
} else {
ret = -1;
}
if (ret != -1) {
r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
@ -2943,7 +2940,6 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
// have to escape any quotes.
int j, len = strlen (buf);
char *duped = strdup (buf);
i = 4, j = 4;
for (i = 4, j = 4; i < len; ++i,++j) {
char c = duped[i];
if (c == '"' && i != (len - 1)) {