mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-13 02:21:34 +00:00
Fix a heap use after free
This commit is contained in:
parent
78d5a78609
commit
67f0a0f244
@ -29,14 +29,25 @@ static void XREFKEY(char * const key, const size_t key_len,
|
||||
}
|
||||
|
||||
R_API int r_anal_xrefs_load(RAnal *anal, const char *prjfile) {
|
||||
char *path, *db = r_str_newf (R2_HOMEDIR"/projects/%s.d", prjfile);
|
||||
char *path, *db = r_str_newf (R2_HOMEDIR"/projects/%s.d", prjfile);
|
||||
ut8 found = 0;
|
||||
SdbListIter *it;
|
||||
SdbNs *ns;
|
||||
if (!db) return R_FALSE;
|
||||
path = r_str_home (db);
|
||||
if (!path) {
|
||||
free (db);
|
||||
return R_FALSE;
|
||||
}
|
||||
sdb_free (DB);
|
||||
|
||||
ls_foreach (anal->sdb->ns, it, ns){
|
||||
if (ns->sdb == DB){
|
||||
ls_delete (anal->sdb->ns, it);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) sdb_free (DB);
|
||||
DB = sdb_new (path, "xrefs", 0);
|
||||
if (!DB) {
|
||||
free (db);
|
||||
|
Loading…
x
Reference in New Issue
Block a user