]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
lib/anon_cred.c: Add check for gnutls_calloc
authorJiasheng Jiang <jiashengjiangcool@gmail.com>
Sat, 2 Aug 2025 15:38:40 +0000 (15:38 +0000)
committerDaiki Ueno <ueno@gnu.org>
Mon, 4 Aug 2025 05:10:25 +0000 (14:10 +0900)
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 <jiashengjiangcool@gmail.com>
lib/anon_cred.c

index 4e951be308d8648c3acfaf7c410ee4556c2aaa1c..e6b78e00857161138cf8328aba9eddd3209d6938 100644 (file)
@@ -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;
 }