Some more coverity fixes (#15802)
This commit is contained in:
parent
3e3a06856f
commit
b4de5c5113
|
@ -420,6 +420,8 @@ static void serialize(RAnal *a, RSignItem *it, char *k, char *v) {
|
|||
free (hexgraph);
|
||||
free (refs);
|
||||
free (vars);
|
||||
free (xrefs);
|
||||
free (types);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1007,15 +1007,18 @@ R_API void r_bin_list_archs(RBin *bin, int mode) {
|
|||
//are we with xtr format?
|
||||
if (binfile && binfile->curxtr) {
|
||||
list_xtr_archs (bin, mode);
|
||||
r_table_free (table);
|
||||
return;
|
||||
}
|
||||
Sdb *binfile_sdb = binfile? binfile->sdb: NULL;
|
||||
if (!binfile_sdb) {
|
||||
// eprintf ("Cannot find SDB!\n");
|
||||
r_table_free (table);
|
||||
return;
|
||||
}
|
||||
if (!binfile) {
|
||||
// eprintf ("Binary format not currently loaded!\n");
|
||||
r_table_free (table);
|
||||
return;
|
||||
}
|
||||
sdb_unset (binfile_sdb, ARCHS_KEY, 0);
|
||||
|
@ -1028,6 +1031,7 @@ R_API void r_bin_list_archs(RBin *bin, int mode) {
|
|||
RBinFile *nbinfile = r_bin_file_find_by_name_n (bin, name, i);
|
||||
if (!nbinfile) {
|
||||
pj_free (pj);
|
||||
r_table_free (table);
|
||||
return;
|
||||
}
|
||||
i = -1;
|
||||
|
|
|
@ -70,7 +70,7 @@ R_API char *r_bin_demangle(RBinFile *bf, const char *def, const char *str, ut64
|
|||
RBin *bin = bf? bf->rbin: NULL;
|
||||
RBinObject *o = bf? bf->o: NULL;
|
||||
RListIter *iter;
|
||||
const char *lib;
|
||||
const char *lib = NULL;
|
||||
if (!strncmp (str, "reloc.", 6)) {
|
||||
str += 6;
|
||||
}
|
||||
|
|
|
@ -1553,6 +1553,7 @@ static void parse_class(RBinFile *bf, RBinDexClass *c, int class_index, int *met
|
|||
dex->header.data_offset + dex->header.data_size) {
|
||||
int types_list_size = r_buf_read_le32_at (bf->buf, c->interfaces_offset);
|
||||
if (types_list_size < 0 || types_list_size >= dex->header.types_size ) {
|
||||
free (str);
|
||||
return;
|
||||
}
|
||||
for (z = 0; z < types_list_size; z++) {
|
||||
|
|
|
@ -135,6 +135,8 @@ static bool load_buffer(RBinFile *bf, void **bin_obj, RBuffer *buf, ut64 loadadd
|
|||
return true;
|
||||
beach:
|
||||
free (qo);
|
||||
r_list_free (fixups);
|
||||
r_list_free (sections);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ static RPrelinkRange *get_prelink_info_range_from_mach0(struct MACH0_(obj_t) *ma
|
|||
|
||||
RPrelinkRange *prelink_range = R_NEW0 (RPrelinkRange);
|
||||
if (!prelink_range) {
|
||||
R_FREE (sections);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ static int download(struct SPDBDownloader *pd) {
|
|||
R_FREE (abspath_to_archive);
|
||||
R_FREE (archive_name_escaped);
|
||||
R_FREE (symbol_store_path);
|
||||
R_FREE (dbg_file);
|
||||
R_FREE (guid);
|
||||
R_FREE (archive_name);
|
||||
R_FREE (abspath_to_file);
|
||||
|
|
|
@ -218,7 +218,7 @@ R_API char *r_cons_hud(RList *list, const char *prompt) {
|
|||
for (;;) {
|
||||
r_cons_gotoxy (0, 0);
|
||||
hud->current_entry_n = 0;
|
||||
|
||||
|
||||
if (hud->top_entry_n < 0) {
|
||||
hud->top_entry_n = 0;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ R_API char *r_cons_hud(RList *list, const char *prompt) {
|
|||
(void) r_line_readline ();
|
||||
memset (user_input, 0, HUD_BUF_SIZE);
|
||||
memset (hud_prompt, 0, HUD_BUF_SIZE + 1);
|
||||
strcpy (user_input, I(line)->buffer.data); // to search
|
||||
strncpy (user_input, I(line)->buffer.data, HUD_BUF_SIZE - 1); // to search
|
||||
strcpy (hud_prompt, user_input); // to display
|
||||
int i;
|
||||
for (i = I(line)->buffer.length; i > I(line)->buffer.index; i--) {
|
||||
|
@ -269,7 +269,7 @@ R_API char *r_cons_hud(RList *list, const char *prompt) {
|
|||
r_cons_show_cursor (true);
|
||||
r_cons_set_raw (false);
|
||||
return strdup (selected_entry);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
goto _beach;
|
||||
}
|
||||
|
|
|
@ -3105,6 +3105,7 @@ R_API int r_core_anal_fcn_list(RCore *core, const char *input, const char *rad)
|
|||
r_list_sort (fcns, cmpaddr);
|
||||
RList *flist = r_list_newf ((RListFree) r_listinfo_free);
|
||||
if (!flist) {
|
||||
r_list_free (fcns);
|
||||
return -1;
|
||||
}
|
||||
ls_foreach (fcns, iter, fcn) {
|
||||
|
|
|
@ -916,7 +916,9 @@ static char *langFromHashbang(RCore *core, const char *file) {
|
|||
if (nl) {
|
||||
*nl = 0;
|
||||
}
|
||||
return strdup (firstLine + 2);
|
||||
nl = strdup (firstLine + 2);
|
||||
r_sandbox_close (fd);
|
||||
return nl;
|
||||
}
|
||||
r_sandbox_close (fd);
|
||||
}
|
||||
|
|
|
@ -9640,6 +9640,7 @@ static void cmd_anal_aC(RCore *core, const char *input) {
|
|||
}
|
||||
RAnalOp* op = r_core_anal_op (core, pcv, -1);
|
||||
if (!op) {
|
||||
r_strbuf_free (sb);
|
||||
return;
|
||||
}
|
||||
bool go_on = true;
|
||||
|
|
|
@ -470,6 +470,7 @@ static void cmd_flag_tags(RCore *core, const char *input) {
|
|||
r_cons_printf ("ft %s %s\n", tag, flags);
|
||||
}
|
||||
r_list_free (list);
|
||||
free (inp);
|
||||
return;
|
||||
}
|
||||
if (mode == 'j') { // "ftj"
|
||||
|
@ -489,6 +490,7 @@ static void cmd_flag_tags(RCore *core, const char *input) {
|
|||
}
|
||||
pj_end (pj);
|
||||
r_list_free (list);
|
||||
free (inp);
|
||||
r_cons_printf ("%s\n", pj_string (pj));
|
||||
pj_free (pj);
|
||||
return;
|
||||
|
|
|
@ -1789,6 +1789,7 @@ static int cmd_open(void *data, const char *input) {
|
|||
}
|
||||
}
|
||||
if ((fdx == -1) || (fd == -1) || (fdx == fd)) {
|
||||
free (inp);
|
||||
break;
|
||||
}
|
||||
r_io_desc_exchange (core->io, fd, fdx);
|
||||
|
|
|
@ -230,6 +230,7 @@ static bool encrypt_or_decrypt_block(RCore *core, const char *algo, const char *
|
|||
}
|
||||
if (!no_key_mode && keylen < 1) {
|
||||
eprintf ("%s key not defined. Use -S [key]\n", ((!direction) ? "Encryption" : "Decryption"));
|
||||
free (binkey);
|
||||
return false;
|
||||
}
|
||||
RCrypto *cry = r_crypto_new ();
|
||||
|
|
|
@ -87,6 +87,7 @@ static int lang_v_file(RLang *lang, const char *file) {
|
|||
char *buf = r_str_newf ("v -cflags '-shared -fPIC' -o %s %s", shl, file);
|
||||
free (name);
|
||||
if (r_sandbox_system (buf, 1) != 0) {
|
||||
free (shl);
|
||||
free (buf);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -997,6 +997,7 @@ R_API int r_main_rabin2(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
r_core_fini (&core);
|
||||
r_list_free (files);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue