metajack / libstrophe

The libstrophe repository has moved to https://github.com/strophe/libstrophe
http://strophe.im/libstrophe
Other
135 stars 49 forks source link

Memory leaks #4

Closed elisamanfrin closed 12 years ago

elisamanfrin commented 13 years ago

I've recently started using libstrophe and found some memory leaks. Below is a diff of how I fixed them:

diff -u src-orig/auth.c src/auth.c
--- src-orig/auth.c 2010-08-04 11:41:36.000000000 -0300
+++ src/auth.c  2011-01-11 09:53:23.404760139 -0200
@@ -788,7 +788,9 @@
        }
        xmpp_stanza_set_text(text, resource);
        xmpp_stanza_add_child(res, text);
+       xmpp_stanza_release(text);
        xmpp_stanza_add_child(bind, res);
+       xmpp_stanza_release(res);
        xmpp_free(conn->ctx, resource);
    }

diff -u src-orig/tls_openssl.c src/tls_openssl.c
--- src-orig/tls_openssl.c  2010-08-04 11:41:36.000000000 -0300
+++ src/tls_openssl.c   2011-01-11 09:53:23.404760139 -0200
@@ -87,6 +87,7 @@

 void tls_free(tls_t *tls)
 {
+    SSL_free(tls->ssl);
     SSL_CTX_free(tls->ssl_ctx);
     xmpp_free(tls->ctx, tls);
     return;
metajack commented 12 years ago

Committed. Thanks for catching this!