Delete temporary rarun2 profile when using r2 -X

This commit is contained in:
pancake 2017-04-27 00:04:28 +00:00
parent 6f1d8e161a
commit 835319ae8f
2 changed files with 5 additions and 3 deletions

View File

@ -708,15 +708,14 @@ int main(int argc, char **argv, char **envp) {
return main_help (help > 1? 2: 0);
}
if (customRarunProfile) {
char *tfn = r_file_temp (NULL);
char *tfn = r_file_temp (".rarun2");
if (!r_file_dump (tfn, (const ut8*)customRarunProfile, strlen (customRarunProfile), 0)) {
eprintf ("Cannot create %s\n", tfn);
} else {
haveRarunProfile = true;
r_config_set (r.config, "dbg.profile", tfn);
}
// TODO: must be removed or just dont use a temporary file
// TODO this current code is leaking temporary files and memory
free (tfn);
}
if (debug == 1) {
if (optind >= argc && !haveRarunProfile) {

View File

@ -235,6 +235,9 @@ static RRunProfile* _get_run_profile(RIO *io, int bits, char **argv) {
r_run_free (rp);
return NULL;
}
if (strstr (io->runprofile, R_SYS_DIR ".rarun2.")) {
(void)r_file_rm (io->runprofile);
}
}
if (bits == 64) {
r_run_parseline (rp, expr=strdup ("bits=64"));