Don't free aliased pointers in ctx cmp_ctx tests
authorNeil Horman <nhorman@openssl.org>
Wed, 22 Nov 2023 17:16:54 +0000 (12:16 -0500)
committerNeil Horman <nhorman@openssl.org>
Fri, 1 Dec 2023 16:14:45 +0000 (11:14 -0500)
commit9819ba5762aaa1fbdf35e68f1495391bc3e3d43c
treeff84f6a41cc6f2f9b9acc5eb6d3efb053bd7827b
parent0d96d00f1f42b1fc67d963602466e1bbf37900a3
Don't free aliased pointers in ctx cmp_ctx tests

Coverity recorded issues 1551739 and 1551737, a potential double free in the
tests.  It occurs when the DUP operation fails in such a way val3_read is
returned as the same pointer as val2_read.  Ideally it should never
happen, but resetting val3_read to 0 should satisfy coverity that there
is no issue here

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22800)

(cherry picked from commit c8ca810da9c47d8cb6988fd14e1cb4e20b0877e8)
test/cmp_ctx_test.c