Various mem leak fixes (#12361)

This commit is contained in:
David CARLIER 2018-12-01 15:44:55 +00:00 committed by radare
parent 3e66e7682f
commit 3dbde0800a
3 changed files with 6 additions and 0 deletions

View File

@ -2126,6 +2126,7 @@ struct reloc_t* MACH0_(get_relocs)(struct MACH0_(obj_t)* bin) {
bprintf ("Error: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB"
" has unexistent segment %d\n", seg_idx);
addr = 0LL;
free (relocs);
return 0; // early exit to avoid future mayhem
} else {
addr = bin->segs[seg_idx].vmaddr + ULEB();

View File

@ -1128,12 +1128,14 @@ static EDemanglerErr parse_microsoft_mangled_name(char *sym, char **demangled_na
i = strlen (curr_pos);
if (!i || i > 2) {
err = eDemanglerErrUncorrectMangledSymbol;
R_FREE (tmp);
goto parse_microsoft_mangled_name_err;
}
if (i == 2) {
if (*curr_pos != 'E') {
err = eDemanglerErrUncorrectMangledSymbol;
R_FREE (tmp);
goto parse_microsoft_mangled_name_err;
}
ptr64 = "__ptr64";
@ -1153,6 +1155,7 @@ static EDemanglerErr parse_microsoft_mangled_name(char *sym, char **demangled_na
SET_STORAGE_CLASS ('D', "const volatile");
default:
err = eDemanglerErrUncorrectMangledSymbol;
R_FREE (tmp);
goto parse_microsoft_mangled_name_err;
}
#undef SET_STORAGE_CLASS

View File

@ -1573,6 +1573,8 @@ int r_print_format_struct_size(const char *f, RPrint *p, int mode, int n) {
} else {
format = sdb_get (p->formats, structname + 1, NULL);
if (format && !strncmp (format, f, strlen (format) - 1)) { // Avoid recursion here
free (o);
free (structname);
return -1;
}
if (!format) { // Fetch format from types db