On 7/14/26 10:35, Daniel Gustafsson wrote:
The comment should maybe also add that entry and peer_cn_asn1 too are OpenSSL
owned pointers. Just saying it for peer_cn_internal seems a bit odd to me.
The other pointers are of OpenSSL data types and those are rarely freed unless
a matching _new or _dup method has been called, whereas peer_cn_internal is a
char pointer extracted with _get0_data. To me the latter seemed more
reasonable to believe it was caller owned, but I can remove the comment
altogether if it's deemed useless.
I don't have a strong opinion here so do whatever you feel like, but at
least to me the current comment does not add much value.
The attached also contains the non-null guards from Tristans review upthread.
My compiler did not like the mix of both assert and nonnull attribute.
In file included from ../postgresql/src/include/postgres.h:48,
from
../postgresql/src/backend/libpq/be-secure-openssl.c:17:
../postgresql/src/backend/libpq/be-secure-openssl.c: In function
‘init_host_context’:
../postgresql/src/include/c.h:1018:20: warning: ‘nonnull’ argument
‘hasWarned’ compared to NULL [-Wnonnull-compare]
1018 | if (!(condition)) \
| ^
../postgresql/src/backend/libpq/be-secure-openssl.c:613:9: note: in
expansion of macro ‘Assert’
613 | Assert(hasWarned);
| ^~~~~~
--
Andreas Karlsson
Percona