summaryrefslogtreecommitdiff
path: root/test/conf_include_test.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-25 12:57:37 +1000
committerPauli <pauli@openssl.org>2021-06-26 11:33:52 +1000
commit711d5a2fc0d611d5574c6d81b9cc0aa1564d2d2a (patch)
tree9e854355de37a20482e70b0fc4579ada28983aa0 /test/conf_include_test.c
parent1f25fd161698e7b93d43872735793b084f2d92af (diff)
downloadopenssl-new-711d5a2fc0d611d5574c6d81b9cc0aa1564d2d2a.tar.gz
test: avoid memory leaks on errors
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15910)
Diffstat (limited to 'test/conf_include_test.c')
-rw-r--r--test/conf_include_test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/conf_include_test.c b/test/conf_include_test.c
index 1c00c601e5..2481a2380b 100644
--- a/test/conf_include_test.c
+++ b/test/conf_include_test.c
@@ -42,7 +42,7 @@ static int change_path(const char *file)
char *s = OPENSSL_strdup(file);
char *p = s;
char *last = NULL;
- int ret;
+ int ret = 0;
if (s == NULL)
return -1;
@@ -51,11 +51,12 @@ static int change_path(const char *file)
last = p++;
}
if (last == NULL)
- return 0;
+ goto err;
last[DIRSEP_PRESERVE] = 0;
TEST_note("changing path to %s", s);
ret = chdir(s);
+ err:
OPENSSL_free(s);
return ret;
}