apache
Pointer "eckey" is assigned, but there is no call to the free function.
Bug fixed by commit 35ae2e259e4
Type | MemoryLeak |
Config | HAVE_ECC (1st degree) |
Fix-in | code |
Location | modules/ssl/ |
#include <stdlib.h> int ssl_init_server_certs() { #ifdef HAVE_ECC int *eckey; #endif #ifdef HAVE_ECC eckey = malloc(sizeof(int)); if (rand() % 2) { *eckey = 30; } else { #if defined(SSL_CTX_set_ecdh_auto) // do something #else *eckey = 15; #endif } #endif // code making use of 'eckey' // return having forgotten to free the memory return 0; } int ssl_init_server_ctx() { return ssl_init_server_certs(); } int ssl_init_ConfigureServer() { return ssl_init_server_ctx(); } int ssl_init_Module() { return ssl_init_ConfigureServer(); } int main(void) { ssl_init_Module(); return 0; }
. call modules/ssl/ssl_engine_init.c:141:ssl_init_Module() . 310: ssl_init_ConfigureServer() .. call modules/ssl/ssl_engine_init.c:1492:ssl_init_ConfigureServer() .. 1505: ssl_init_server_ctx() ... call modules/ssl/ssl_engine_init.c:1383:ssl_init_server_ctx() ... 1410: ssl_init_server_certs() ... call modules/ssl/ssl_engine_init.c:971:ssl_init_server_certs() ... 1141: SSL_CTX_set_tmp_ecdh(mctx->ssl_ctx, eckey); ... ERROR 1150: return APR_SUCCESS;