diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2018-09-25 13:24:27 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-09-27 15:21:30 +0200 |
commit | 6eef4b4a3c32f01532b241f690e8a276d92c2ca4 (patch) | |
tree | f77ee139146e9c291f71839dffbe35c082a70725 /tests/unittests/torture_keyfiles.c | |
parent | 79e907402e425f359b66b9bc3198514ae11bf240 (diff) | |
download | libssh-6eef4b4a3c32f01532b241f690e8a276d92c2ca4.tar.gz libssh-6eef4b4a3c32f01532b241f690e8a276d92c2ca4.tar.xz libssh-6eef4b4a3c32f01532b241f690e8a276d92c2ca4.zip |
tests: Add frees to avoid memory leak errors
The added frees are unnecessary, but the static analyser does not know.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests/unittests/torture_keyfiles.c')
-rw-r--r-- | tests/unittests/torture_keyfiles.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/unittests/torture_keyfiles.c b/tests/unittests/torture_keyfiles.c index 55af6c7b..59a4f5ee 100644 --- a/tests/unittests/torture_keyfiles.c +++ b/tests/unittests/torture_keyfiles.c @@ -119,11 +119,17 @@ static void torture_pubkey_from_file(void **state) { rc = ssh_try_publickey_from_file(session, LIBSSH_RSA_TESTKEY, &pubkey, &type); assert_true(rc == 1); + /* This free is unnecessary, but the static analyser does not know */ + SSH_STRING_FREE(pubkey); + /* test if it returns -1 if privkey doesn't exist */ unlink(LIBSSH_RSA_TESTKEY); rc = ssh_try_publickey_from_file(session, LIBSSH_RSA_TESTKEY, &pubkey, &type); assert_true(rc == -1); + + /* This free is unnecessary, but the static analyser does not know */ + SSH_STRING_FREE(pubkey); } static int torture_read_one_line(const char *filename, char *buffer, size_t len) { |