Fix memleak and null deref in types

This commit is contained in:
pancake 2018-05-30 17:26:04 +02:00
parent 92e9604f6a
commit 9b91799591
2 changed files with 4 additions and 0 deletions

View File

@ -216,6 +216,7 @@ R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn) {
int *previnstr = calloc (MAXINSTR + 1, sizeof (int));
if (!previnstr) {
eprintf ("Cannot allocate %d byte(s)\n", MAXINSTR + 1);
free (buf);
return;
}
r_cons_break_push (NULL, NULL);

View File

@ -481,6 +481,9 @@ R_API char *r_type_func_guess(Sdb *TDB, char *func_name) {
// also try module.dll_function and function_number
if ((first = strchr (str, '_'))) {
last = (char *)r_str_lchr (first, '_');
if (!last) {
goto out;
}
// middle + suffix or right half
if ((result = type_func_try_guess (TDB, first + 1))) {
goto out;