Fix few memleaks spotted by coverity scan

This commit is contained in:
pancake 2024-05-13 01:03:59 +02:00
parent 7ffeaaebfe
commit 0e30faff28
2 changed files with 4 additions and 2 deletions

View File

@ -1426,6 +1426,7 @@ static void cmd_id(RCore *core, PJ *pj, const char *input, int is_array, int mod
char* dir = r_file_dirname (core->bin->cur->file);
filename = r_str_newf ("%s/%s", dir, basename);
file_found = r_file_exists (filename);
free (dir);
} else {
filename = strdup (basename);
}
@ -1439,9 +1440,10 @@ static void cmd_id(RCore *core, PJ *pj, const char *input, int is_array, int mod
symstore_path, base_file, info->guid, base_file);
file_found = r_file_exists (pdb_path);
if (file_found) {
free (filename);
filename = pdb_path;
} else {
R_FREE (pdb_path);
free (pdb_path);
}
}
}

View File

@ -5,7 +5,7 @@
static char *getFortuneFile(RCore *core, const char *type) {
r_strf_var (fname, 64, "fortunes.%s", type);
char *fortunedir = r_xdg_datadir ("fortunes");
char *path = path = r_file_new (fortunedir, fname, NULL);
char *path = r_file_new (fortunedir, fname, NULL);
free (fortunedir);
if (path && r_file_exists (path)) {
return path;