]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: fix potential memory leak in ssl_sock_load_dh_params()
authorRoberto Guimaraes <rguimaraes@fastly.com>
Sat, 11 Jun 2016 22:58:10 +0000 (15:58 -0700)
committerWilly Tarreau <w@1wt.eu>
Sun, 12 Jun 2016 11:12:32 +0000 (13:12 +0200)
Valgrind reports that the memory allocated in ssl_get_dh_1024() was leaking. Upon further inspection of openssl code, it seems that SSL_CTX_set_tmp_dh makes a copy of the data, so calling DH_free afterwards makes sense.

src/ssl_sock.c

index 0d35c298dcca4cb99eb1df15764dab4bb4d744c0..378fddc1c4d151615e1fb61577440291ce69e479 100644 (file)
@@ -1643,6 +1643,7 @@ int ssl_sock_load_dh_params(SSL_CTX *ctx, const char *file)
                                goto end;
 
                        SSL_CTX_set_tmp_dh(ctx, local_dh_1024);
+                       DH_free(local_dh_1024);
                }
                else {
                        SSL_CTX_set_tmp_dh_callback(ctx, ssl_get_tmp_dh);