[Vm-dev] [commit][2792] fix memory leaks in SqueakSSL
commits at squeakvm.org
commits at squeakvm.org
Sun Oct 20 15:06:48 UTC 2013
Revision: 2792
Author: piumarta
Date: 2013-10-20 08:06:47 -0700 (Sun, 20 Oct 2013)
Log Message:
-----------
fix memory leaks in SqueakSSL
Modified Paths:
--------------
trunk/platforms/unix/ChangeLog
trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c
Modified: trunk/platforms/unix/ChangeLog
===================================================================
--- trunk/platforms/unix/ChangeLog 2013-10-19 19:35:14 UTC (rev 2791)
+++ trunk/platforms/unix/ChangeLog 2013-10-20 15:06:47 UTC (rev 2792)
@@ -1,3 +1,8 @@
+2013-10-20 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
+
+ * plugins/SqueakSSL/sqUnixOpenSSL.c: Fix memory leaks (thanks to
+ Levente Uzonyl).
+
2013-09-09 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)>
* cmake/configure (svnversion): Look for evidence of checked out
Modified: trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c
===================================================================
--- trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c 2013-10-19 19:35:14 UTC (rev 2791)
+++ trunk/platforms/unix/plugins/SqueakSSL/sqUnixOpenSSL.c 2013-10-20 15:06:47 UTC (rev 2792)
@@ -124,8 +124,15 @@
if(ssl == NULL) return 0;
if(ssl->ctx) SSL_CTX_free(ssl->ctx);
- if(ssl->ssl) SSL_free(ssl->ssl);
+ if(ssl->ssl) {
+ SSL_free(ssl->ssl); // This will also free bioRead and bioWrite
+ } else {
+ // SSL_new didn't get called, have to free bioRead and bioWrite manually
+ BIO_free_all(ssl->bioRead);
+ BIO_free_all(ssl->bioWrite);
+ }
+
if(ssl->certName) free(ssl->certName);
if(ssl->peerName) free(ssl->peerName);
@@ -394,6 +401,7 @@
switch(propID) {
case SQSSL_PROP_CERTNAME: ssl->certName = property; break;
default:
+ if(property) free(property);
if(ssl->loglevel) printf("sqSetStringPropertySSL: Unknown property ID %d\n", propID);
return 0;
}
More information about the Vm-dev
mailing list