From 9cde5fa319ef65fb178f2c9b73b61a9e882bb1b9 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Fri, 20 May 2005 21:52:07 +0000 Subject: [PATCH] Minor memory leak spotted by Mikhail Kruk. [originally from svn r5815] --- windows/winstore.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/windows/winstore.c b/windows/winstore.c index 2e812c34..31aa6372 100644 --- a/windows/winstore.c +++ b/windows/winstore.c @@ -406,10 +406,12 @@ void store_host_key(const char *hostname, int port, hostkey_regname(regname, hostname, port, keytype); if (RegCreateKey(HKEY_CURRENT_USER, PUTTY_REG_POS "\\SshHostKeys", - &rkey) != ERROR_SUCCESS) - return; /* key does not exist in registry */ - RegSetValueEx(rkey, regname, 0, REG_SZ, key, strlen(key) + 1); - RegCloseKey(rkey); + &rkey) == ERROR_SUCCESS) { + RegSetValueEx(rkey, regname, 0, REG_SZ, key, strlen(key) + 1); + RegCloseKey(rkey); + } /* else key does not exist in registry */ + + sfree(regname); } /*