Browse Source

PuTTY memory leak

Source commit: 6bd7fbab73565dba31fe9295c1f896ba8252db28
Martin Prikryl 9 years ago
parent
commit
7fb18cf205
3 changed files with 15 additions and 0 deletions
  1. 1 0
      source/core/PuttyIntf.cpp
  2. 4 0
      source/putty/puttyexp.h
  3. 10 0
      source/putty/windows/winsecur.c

+ 1 - 0
source/core/PuttyIntf.cpp

@@ -61,6 +61,7 @@ void __fastcall PuttyFinalize()
 
   sk_cleanup();
   win_misc_cleanup();
+  win_secur_cleanup();
   DeleteCriticalSection(&putty_section);
 }
 //---------------------------------------------------------------------------

+ 4 - 0
source/putty/puttyexp.h

@@ -80,4 +80,8 @@ void win_misc_cleanup();
 
 const char * get_putty_version();
 
+// from winsecur.c
+
+void win_secur_cleanup(void);
+
 #endif

+ 10 - 0
source/putty/windows/winsecur.c

@@ -15,6 +15,16 @@
 /* Initialised once, then kept around to reuse forever */
 static PSID worldsid, networksid, usersid;
 
+#ifdef MPEXT
+void win_secur_cleanup(void)
+{
+    if (usersid)
+    {
+        sfree(usersid);
+        usersid = NULL;
+    }
+}
+#endif
 
 int got_advapi(void)
 {