From: Jiasheng Jiang Date: Sat, 2 Aug 2025 15:38:40 +0000 (+0000) Subject: lib/anon_cred.c: Add check for gnutls_calloc X-Git-Tag: 3.8.11~21^2~6 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=3145b5dd4ecc3e2a0e2e9029a70fb07942b2caf5;p=thirdparty%2Fgnutls.git lib/anon_cred.c: Add check for gnutls_calloc According to the comment above, add check for the return value of gnutls_calloc() and return an error code if it fails. Fixes: 23efd9990 ("The Diffie Hellman parameters are now stored in the credentials structures. This will allow precomputation of signatures (for DHE cipher suites).") Signed-off-by: Jiasheng Jiang --- diff --git a/lib/anon_cred.c b/lib/anon_cred.c index 4e951be308..e6b78e0085 100644 --- a/lib/anon_cred.c +++ b/lib/anon_cred.c @@ -56,6 +56,8 @@ void gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t sc) int gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials_t *sc) { *sc = gnutls_calloc(1, sizeof(anon_server_credentials_st)); + if (*sc == NULL) + return GNUTLS_E_MEMORY_ERROR; return 0; }