[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/1] tests: plug leak in torture_bind_options_import_key


From 8e748fa1329991dab47c6e5f2e4ef6d717d4ecbf Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Sat, 14 Jan 2017 13:35:15 -0500
Subject: [PATCH 1/1] tests: plug leak in torture_bind_options_import_key

Signed-off-by: Jon Simons <jon@xxxxxxxxxxxxx>
---
 tests/unittests/torture_options.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c
index 820e607d..30ca2ac2 100644
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -218,8 +218,8 @@ static void torture_bind_options_import_key(void **state)
 {
     ssh_bind bind = *state;
     int rc;
-    ssh_key key = ssh_key_new();
     const char *base64_key;
+    ssh_key key = ssh_key_new();
 
     /* set null */
     rc = ssh_bind_options_set(bind, SSH_BIND_OPTIONS_IMPORT_KEY, NULL);
@@ -227,6 +227,7 @@ static void torture_bind_options_import_key(void **state)
     /* set invalid key */
     rc = ssh_bind_options_set(bind, SSH_BIND_OPTIONS_IMPORT_KEY, key);
     assert_int_equal(rc, -1);
+    ssh_key_free(key);
 
     /* set rsa key */
     base64_key = torture_get_testkey(SSH_KEYTYPE_RSA, 0, 0);
-- 
2.13.2


Archive administrator: postmaster@lists.cynapses.org