Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34591 )
Change subject: vc/cavium/bdk/libbdk-hal: Fix eye data memory leak ......................................................................
vc/cavium/bdk/libbdk-hal: Fix eye data memory leak
This function can capture and allocate its own eye data, so in that case set need_free to true so it is freed at the end.
Change-Id: I63ca6d743e6610d3e3ab6bd7b0356aabdfa6f784 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1393969 --- M src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/34591/1
diff --git a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c index f7d631f..5416b73 100644 --- a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c +++ b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c @@ -362,9 +362,12 @@ bdk_error("Failed to allocate space for eye\n"); return -1; } - if (bdk_qlm_eye_capture(node, qlm, qlm_lane, eye_data)) - return -1; + if (bdk_qlm_eye_capture(node, qlm, qlm_lane, eye_data)) { + free(eye_data); + return -1; + } eye = eye_data; + need_free = 1; }
/* Calculate the max eye width */