Skip to content

Commit

Permalink
Fix offroad leak in r2r
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Jan 8, 2025
1 parent 821ca88 commit 1f314ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions binr/r2r/r2r.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ int main(int argc, char **argv) {
dir_found = r2r_chdir (argv[0]);
}
if (!dir_found) {
free (cwd);
R_LOG_ERROR ("Cannot find db/ directory related to the given test");
return -1;
}
Expand All @@ -464,6 +465,7 @@ int main(int argc, char **argv) {
}

if (!r2r_subprocess_init ()) {
free (cwd);
R_LOG_ERROR ("Subprocess init failed");
return -1;
}
Expand Down Expand Up @@ -524,6 +526,7 @@ int main(int argc, char **argv) {
eprintf ("Category: %s\n", arg);
if (!strcmp (arg, "unit")) {
if (!r2r_test_run_unit ()) {
free (cwd);
return -1;
}
continue;
Expand Down Expand Up @@ -567,6 +570,7 @@ int main(int argc, char **argv) {
}
}
r_list_free (tests);
free (cwd);
return grc;
// continue;
}
Expand All @@ -575,6 +579,7 @@ int main(int argc, char **argv) {
R_LOG_ERROR ("Failed to load tests from \"%s\"", tf);
r2r_test_database_free (state.db);
free (tf);
free (cwd);
return -1;
}
free (tf);
Expand Down

0 comments on commit 1f314ac

Please sign in to comment.