[gnutls-devel] GnuTLS | Allocate pathname on heap instead of on stack (!1493)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Tue Dec 21 15:52:05 CET 2021




Tim Rühsen commented on a discussion: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_791505299

There are a bunch of other 'pros' (in the list above) that have nothing to do with performance optimzations (it sounds like you are referring to perf opt only).

As it is hard to get test coverage for every possibly error case, I'd try to avoid heap allocations in C/C++ as much as possible. That reduces future maintenance, especially when thinking of future code changes or extensions.

We could consider keeping the dirname and the basename separate, so that we could use openat (at least on POSIX systems). Hm, I think this requires some kind of redesign.

BTW, looking at `gnutls_x509_trust_list_add_trust_file()`, there is a memory leak if both `ca_file` and `crl_file` are set but `read_file(crl_file, ...)` returns NULL. Less heap allocations means less memory faults - that's why I am a bit hesitant regarding this PR.

But please feel free to merge. We can discuss any redesign at a later time. I didn't want to "capture" this PR :-)

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1493#note_791505299
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/20211221/3e7fab78/attachment.html>


More information about the Gnutls-devel mailing list