Minor fixes/cleanups (#12349)

This commit is contained in:
dav1901 2018-11-29 12:22:32 +02:00 committed by radare
parent 22a880cbc9
commit cc26fd73ba
8 changed files with 14 additions and 4 deletions

View File

@ -180,7 +180,7 @@ static int decode_emulation(ut16 instr, struct msp430_cmd *cmd)
/* return #byte of instruction */
static int decode_addressing_mode(ut16 instr, ut16 op1, ut16 op2, struct msp430_cmd *cmd)
{
int ret, srcOperInCodeWord = 0;
int ret = 0, srcOperInCodeWord = 0;
ut8 as, ad, src, dst;
ut16 op;
char dstbuf[16];

View File

@ -2993,6 +2993,7 @@ beach:
imps = realloc (imports, (nimp + 1) * sizeof(struct r_bin_pe_import_t));
if (!imps) {
r_sys_perror ("realloc (import)");
free (imports);
return NULL;
}
imports = imps;

View File

@ -3400,6 +3400,7 @@ R_API void r_core_bin_export_info_rad(RCore *core) {
flagname = dup;
r_cons_printf ("fl %s %s\n", flagname, v);
}
free (dup);
}
free (offset);
}

View File

@ -550,8 +550,8 @@ R_API RFlagItem *r_flag_set(RFlag *f, const char *name, ut64 off, ut32 size) {
RFlagsAtOffset *flagsAtOffset = R_NEW (RFlagsAtOffset);
if (flagsAtOffset) {
list = r_list_new ();
flagsAtOffset->flags = list;
if (list) {
flagsAtOffset->flags = list;
flagsAtOffset->off = off;
// CID 1378268: Resource leaks (RESOURCE_LEAK)
// Ignoring storage allocated by "r_skiplist_insert(f->by_off, flagsAtOffset)" leaks it.

View File

@ -284,6 +284,8 @@ static int callback_list(void *u, const char *k, const char *v) {
}
if (!strchr (si->name, '.')) {
r_list_append (list, si);
} else {
r_syscall_item_free (si);
}
}
return 1; // continue loop

View File

@ -67,6 +67,8 @@ R_API RList* r_type_get_enum (Sdb *TDB, const char *name) {
free (member);
free (var2);
}
} else {
free (member);
}
}
}

View File

@ -1921,6 +1921,7 @@ R_API char **r_str_argv(const char *cmdline, int *_argc) {
if (tmp) {
argv = tmp;
} else {
free (argv);
argv = NULL;
}
if (_argc) {

View File

@ -63,14 +63,17 @@ R_API const ut8 *r_uleb128_decode(const ut8 *data, int *datalen, ut64 *v) {
R_API const ut8 *r_uleb128_encode(const ut64 s, int *len) {
ut8 c = 0;
int l = 0;
ut8 *otarget = NULL, *target = NULL;
ut8 *otarget = NULL, *target = NULL, *tmptarget = NULL;
ut64 source = s;
do {
l++;
if (!(otarget = realloc (otarget, l))) {
if (!(tmptarget = realloc (otarget, l))) {
l = 0;
free (otarget);
otarget = NULL;
break;
}
otarget = tmptarget;
target = otarget+l-1;
c = 0; //May not be necessary
c = source & 0x7f;