examples/fips_validation: fix dangling pt.val after MCT test
PATCH 1/1 examples/fips_validation: fix dangling pt.val after MCT test
After fips_mct_sha_test() and fips_mct_shake_test() complete, vec.pt.val is freed but left as a non-NULL dangling pointer. Since vec is a file-scope global, the next SHA algorithm's AFT test calls parse_uint8_hex_str(&vec.pt), which checks val->val and calls rte_free() on the stale pointer, producing:
EAL: Error: Invalid memory
Fix by setting vec.pt.val to NULL after rte_free() at the end of both MCT functions so the subsequent rte_free() guard in parse_uint8_hex_str() skips the already-freed pointer.
Signed-off-by Kai Ji <[email protected]>
--- examples/fips_validation/main.c | 2 ++ 1 file changed, 2 insertions(+)
examples/fips_validation/main.c +2 -0
@@ -2610,6 +2610,7 @@ fips_mct_sha_test(void)rte_free (md[i].val);rte_free (vec.pt.val); + vec.pt.val =NULL ;rte_free (val.val);return 0 ;
@@ -2698,6 +2699,7 @@ fips_mct_shake_test(void)rte_free (md.val);rte_free (vec.pt.val); + vec.pt.val =NULL ;rte_free (val.val);return 0 ; }
Signature · 1 line
2.43.0