if (!make) {
make = r_file_path ("make");
}
- return NULL;
+ return make;
}
static bool r2r_test_run_unit(void) {
}
static void r2r_setup_environment(void) {
- if (!r_sys_getenv ("R2_BIN")) {
+ char *r2_bin = r_sys_getenv ("R2_BIN");
+ if (!r2_bin) {
r_sys_setenv ("R2_BIN", R2_BINDIR);
r_sys_setenv_sep ("PATH", R2_BINDIR, false);
}
+ free (r2_bin);
char *have_options = r_sys_getenv ("ASAN_OPTIONS");
if (have_options) {
free (have_options);
int i;
for (i = arg_ind; i < argc; i++) {
const char *arg = argv[i];
+ char *arg_str = NULL;
if (*arg == '@') {
arg++;
eprintf ("Category: %s\n", arg);
} else if (!strcmp (arg, "cmds")) {
arg = "db";
} else {
- arg = r_str_newf ("db/%s", arg + 1);
+ arg_str = r_str_newf ("db/%s", arg + 1);
+ arg = arg_str;
}
}
if (r_str_endswith (arg, ".c")) {
}
}
r_list_free (tests);
+ free (arg_str);
return grc? grc: 1; // Signal special exit
}
char *tf = r_file_abspath_rel (cwd, arg);
if (!tf || !r2r_test_database_load (state->db, tf, skip_json_tests)) {
R_LOG_ERROR ("Failed to load tests from \"%s\"", tf);
free (tf);
+ free (arg_str);
return -1;
}
free (tf);
+ free (arg_str);
}
} else {
if (!r2r_test_database_load (state->db, "db", skip_json_tests)) {
free (cmdline);
return proc;
error:
- if (proc) {
- if (proc->stdin_write) {
- CloseHandle (proc->stdin_write);
- }
- if (proc->stdout_read) {
- CloseHandle (proc->stdout_read);
- }
- if (proc->stderr_read) {
- CloseHandle (proc->stderr_read);
- }
- free (proc);
- proc = NULL;
+ if (proc->stdin_write) {
+ CloseHandle (proc->stdin_write);
}
+ if (proc->stdout_read) {
+ CloseHandle (proc->stdout_read);
+ }
+ if (proc->stderr_read) {
+ CloseHandle (proc->stderr_read);
+ }
+ R_FREE (proc);
goto beach;
}
return proc;
error:
- if (proc && proc->killpipe[0] == -1) {
+ if (proc->killpipe[0] != -1) {
close (proc->killpipe[0]);
}
- if (proc && proc->killpipe[1] == -1) {
+ if (proc->killpipe[1] != -1) {
close (proc->killpipe[1]);
}
free (proc);
- if (stderr_pipe[0] == -1) {
+ if (stderr_pipe[0] != -1) {
close (stderr_pipe[0]);
}
- if (stderr_pipe[1] == -1) {
+ if (stderr_pipe[1] != -1) {
close (stderr_pipe[1]);
}
- if (stdout_pipe[0] == -1) {
+ if (stdout_pipe[0] != -1) {
close (stdout_pipe[0]);
}
- if (stdout_pipe[1] == -1) {
+ if (stdout_pipe[1] != -1) {
close (stdout_pipe[1]);
}
- if (stdin_pipe[0] == -1) {
+ if (stdin_pipe[0] != -1) {
close (stdin_pipe[0]);
}
- if (stdin_pipe[1] == -1) {
+ if (stdin_pipe[1] != -1) {
close (stdin_pipe[1]);
}
r_th_lock_leave (subprocs_mutex);