Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e0e569e

Browse files
committed
Fix memory leak when initializing DH parameters in backend
When loading DH parameters used for the generation of ephemeral DH keys in the backend, the code has never bothered releasing the memory used for the DH information loaded from a file or from libpq's default. This commit makes sure that the information is properly free()'d. Note that as SSL parameters can be reloaded, this can cause an accumulation of memory leaked. As the leak is minor, no backpatch is done. Reported-by: Dmitry Uspenskiy Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org
1 parent 7c85be0 commit e0e569e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/libpq/be-secure-openssl.c

+3
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,11 @@ initialize_dh(SSL_CTX *context, bool isServerStart)
10151015
(errcode(ERRCODE_CONFIG_FILE_ERROR),
10161016
(errmsg("DH: could not set DH parameters: %s",
10171017
SSLerrmessage(ERR_get_error())))));
1018+
DH_free(dh);
10181019
return false;
10191020
}
1021+
1022+
DH_free(dh);
10201023
return true;
10211024
}
10221025

0 commit comments

Comments
 (0)