examples/fips_validation: fix resource leak on failure
PATCH 1/1 examples/fips_validation: fix resource leak on failure
The dst variable went out of scope on failure in the get_writeback_data function. This is now freed before returning -1.
Coverity issue: 363453
--- examples/fips_validation/main.c | 1 + 1 file changed, 1 insertion(+)
examples/fips_validation/main.c +1 -0
@@ -1128,6 +1128,7 @@ get_writeback_data(struct fips_val *val)if (data_len) {RTE_LOG (ERR ,USER1 ,"Error -1: write back data\n" ); +free (dst);return -1 ; }
Signature · 1 line
2.25.1
Quoted 18 lines · Ciara Power
The dst variable went out of scope on failure in the
get_writeback_datafunction. This is now freed before returning -1.Coverity issue: 363453
Fixes 952e10cdad5e ("examples/fips_validation: support scatter gather list")Signed-off-by Ciara Power <[email protected]>--- examples/fips_validation/main.c | 1 + 1 file changed, 1 insertion(+)examples/fips_validation/main.c +0
-0
examples/fips_validation/main.c get_writeback_data(struct fips_val *val) · line 1131
Quoted 4 lines
examples/fips_validation/main.c +1
-0@@ -1128,6 +1128,7 @@ get_writeback_data(struct fips_val *val)if (data_len) {RTE_LOG (ERR ,USER1 ,"Error -1: write back data\n" ); +free (dst);
Hum should we instead free the pointer to the allocated buffer, i.e. wb_data, rather than dst that got potentially incremented?
Signature · 1 line
David Marchand
PATCH v2 1/1 examples/fips_validation: fix resource leak on failure
In reply to Ciara PowerThe wb_data variable went out of scope on failure in the get_writeback_data function. This is now freed before returning -1.
Coverity issue: 363453
---
v2: Fixed incorrect pointer used in free.
--- examples/fips_validation/main.c | 1 + 1 file changed, 1 insertion(+)
examples/fips_validation/main.c +1 -0
@@ -1128,6 +1128,7 @@ get_writeback_data(struct fips_val *val)if (data_len) {RTE_LOG (ERR ,USER1 ,"Error -1: write back data\n" ); +free (wb_data);return -1 ; }
Signature · 1 line
2.25.1
Quoted 8 lines · Ciara Power
The
wb_datavariable went out of scope on failure in theget_writeback_datafunction. This is now freed before returning -1.Coverity issue: 363453
Fixes 952e10cdad5e ("examples/fips_validation: support scatter gather list")Signed-off-by Ciara Power <[email protected]>
Applied, thanks.
Signature · 1 line
David Marchand