[Vm-dev] [commit] r2243 - Fix some memory leakage.

commits at squeakvm.org commits at squeakvm.org
Tue Jul 20 04:05:06 UTC 2010


Author: andreas
Date: 2010-07-19 21:05:05 -0700 (Mon, 19 Jul 2010)
New Revision: 2243

Modified:
   trunk/platforms/win32/plugins/SqueakSSL/sqWin32SSL.c
Log:
Fix some memory leakage.

Modified: trunk/platforms/win32/plugins/SqueakSSL/sqWin32SSL.c
===================================================================
--- trunk/platforms/win32/plugins/SqueakSSL/sqWin32SSL.c	2010-07-19 06:12:14 UTC (rev 2242)
+++ trunk/platforms/win32/plugins/SqueakSSL/sqWin32SSL.c	2010-07-20 04:05:05 UTC (rev 2243)
@@ -1,5 +1,4 @@
 /* sqWin32SSL.c: SqueakSSL implementation for Windows */
-
 #include <windows.h>
 #include <errno.h>
 #include <malloc.h>
@@ -141,7 +140,7 @@
 
 	sc_cred.dwVersion = SCHANNEL_CRED_VERSION;
 	sc_cred.dwFlags = SCH_CRED_NO_DEFAULT_CREDS | SCH_CRED_MANUAL_CRED_VALIDATION;
-	sc_cred.grbitEnabledProtocols = server ? SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER | SP_PROT_SSL2_SERVER : 0;
+	sc_cred.grbitEnabledProtocols = server ? SP_PROT_TLS1_SERVER | SP_PROT_SSL3_SERVER : 0;
 	sc_cred.dwMinimumCipherStrength = 0;
 	sc_cred.dwMaximumCipherStrength = 0;
 
@@ -219,6 +218,8 @@
 	ssl->peerName = _strdup(tmpBuf);
 	if(ssl->loglevel) printf("sqExtractPeerName: Peer name is %s\n", ssl->peerName);
 
+	CertFreeCertificateContext(certHandle);
+
 	return 1;
 }
 
@@ -261,7 +262,7 @@
 	if(!CertGetCertificateChain(NULL, certHandle, NULL,
                                 certHandle->hCertStore,
 								&chainPara, 0, NULL, &chainContext)) {
-		/* XXXX: Does this mean the other end did not provide a cert? */
+		CertFreeCertificateContext(certHandle);
 		ssl->certFlags = SQSSL_OTHER_ISSUE;
 		goto done;
 	}
@@ -319,6 +320,8 @@
 		}
 	}
 done:
+	CertFreeCertificateChain(chainContext);
+	CertFreeCertificateContext(certHandle);
 	return 1;
 }
 



More information about the Vm-dev mailing list