From a8ed5e31dc15df2073825cf25a29211408b58a0d Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 5 Nov 2018 07:52:43 +0100 Subject: [PATCH] tests: Check for NULL in torture_client_config CID 1396566 Signed-off-by: Andreas Schneider --- tests/client/torture_client_config.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/client/torture_client_config.c b/tests/client/torture_client_config.c index 113b4c3f..3cd19a31 100644 --- a/tests/client/torture_client_config.c +++ b/tests/client/torture_client_config.c @@ -65,8 +65,12 @@ static int teardown(void **state) char *filename; filename = ssh_path_expand_tilde("~/.ssh/config"); - unlink(filename); - free(filename); + if (filename != NULL) { + if (strlen(filename) > 0) { + unlink(filename); + } + SAFE_FREE(filename); + } unlink(LIBSSH_SSH_CONFIG);