]> git.ipfire.org Git - thirdparty/openssl.git/commit
test/mem_alloc_test.c: avoid referencing potentially freed old_ret
authorEugene Syromiatnikov <esyr@openssl.org>
Tue, 12 Aug 2025 08:03:43 +0000 (10:03 +0200)
committerNeil Horman <nhorman@openssl.org>
Tue, 19 Aug 2025 18:47:54 +0000 (14:47 -0400)
commit2b76895152fe7c7bcd11b9ae6e712c0437aee8c3
treeec2f6696daed24dd7b2b1d563ff224cdb76df1f0
parentabebeb1bb008452f9d0524509627d015dc69fbd1
test/mem_alloc_test.c: avoid referencing potentially freed old_ret

Referencing to old_ret after it has been freed by realloc is UB, so drop
its usage in the printing routine, and don't check it for being non-NULL
(as it is not a mistake to call free() on NULL pointer anyway).

Fixes: d090695101a9 "test: add a sanity test for memory allocation functions"
Resolves: https://scan5.scan.coverity.com/#/project-view/65279/10222?selectedIssue=1662052
Related: https://github.com/openssl/project/issues/1317
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28238)
test/mem_alloc_test.c