Fix some memleaks

This commit is contained in:
jvoisin 2015-02-05 11:42:46 +01:00
parent 383e225135
commit a2d4bd08bb
2 changed files with 9 additions and 1 deletions

View file

@ -1161,10 +1161,14 @@ if (
}
if (strtab_section->sh_size> ST32_MAX) {
eprintf ("size (syms strtab)");
free (ret);
free (strtab);
return NULL;
}
if ((strtab = (char *)calloc (1, 8+strtab_section->sh_size)) == NULL) {
eprintf ("malloc (syms strtab)");
free (ret);
free (strtab);
return NULL;
}
if (r_buf_read_at (bin->b, strtab_section->sh_offset,
@ -1219,6 +1223,7 @@ if (
} else continue;
if ((ret = realloc (ret, (ret_ctr + 1) * sizeof (struct r_bin_elf_symbol_t))) == NULL) {
perror ("realloc (symbols|imports)");
free (sym);
return NULL;
}
#if 0
@ -1302,6 +1307,7 @@ if (
} else break;
}
}
free (strtab);
return ret;
}

View file

@ -580,8 +580,10 @@ R_API int r_fs_prompt (RFS *fs, const char *root) {
fgets (buf, sizeof (buf)-1, stdin);
if (feof (stdin)) break;
buf[strlen (buf)-1] = '\0';
if (!strcmp (buf, "q") || !strcmp (buf, "exit"))
if (!strcmp (buf, "q") || !strcmp (buf, "exit")) {
r_list_free (list);
return R_TRUE;
}
if (buf[0]=='!') {
r_sandbox_system (buf+1, 1);
} else