aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-09-30 11:54:34 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-09-30 11:54:34 -0400
commitd1642b3514f23be90e8292fce4569990c813d8eb (patch)
treebbee42a7945d50d5d28106ba0424e48b0fb8d787
parent31db9bb6e4434dc888fc724090d8f0d9d8eea619 (diff)
downloadstasis-d1642b3514f23be90e8292fce4569990c813d8eb.tar.gz
Fix leaking of basetemp_path and jxml_path on error
* Reported by @kmacdonald-stsci
-rw-r--r--src/template_func_proto.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/template_func_proto.c b/src/template_func_proto.c
index 9f1283f..9c325bb 100644
--- a/src/template_func_proto.c
+++ b/src/template_func_proto.c
@@ -137,12 +137,15 @@ int tox_run_entrypoint(void *frame, void *data_out) {
}
char *jxml_path = NULL;
if (get_junitxml_file_entrypoint(f, &jxml_path)) {
+ guard_free(basetemp_path);
return -3;
}
const char *tox_target = f->argv[0].t_char_ptr;
const char *pytest_args = f->argv[1].t_char_ptr;
if (isempty(toxconf) || !strcmp(toxconf, "/")) {
SYSERROR("Unsafe toxconf path: '%s'", toxconf);
+ guard_free(basetemp_path);
+ guard_free(jxml_path);
return -4;
}
snprintf(*output, STASIS_BUFSIZ - 1, "\npip install tox && (tox -e py%s%s -c %s --root . -- --basetemp=\"%s\" --junitxml=\"%s\" %s ; rm -f '%s')\n", ctx->meta.python_compact, tox_target, toxconf, basetemp_path, jxml_path, pytest_args ? pytest_args : "", toxconf);