[gnutls-devel] GnuTLS | fix possible memory leakage (!1714)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Sat Feb 25 09:00:56 CET 2023

Daiki Ueno commented on a discussion on src/serv.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1714#note_1292260792

>  				return GNUTLS_E_DB_ERROR;
>  			}
>  			cache_db_alloc = cache_db_alloc * 2 + 1;
> -			cache_db = realloc(cache_db,
> -					   cache_db_alloc * sizeof(CACHE));
> -			if (!cache_db)
> +			ptr = realloc(cache_db,

Yeah, good point; we should always use different pointer for the return value of `*realloc` than the first argument and have a proper NULL check.

I see a similar error a few lines below; could you also fix it?

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1714#note_1292260792
You're receiving this email because of your account on gitlab.com.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20230225/fbbc7d70/attachment.html>

More information about the Gnutls-devel mailing list