diff options
author | Jacob Garber <jgarber1@ualberta.ca> | 2019-07-26 12:17:53 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-08-02 10:00:58 +0000 |
commit | 43d07f75cf001b49422470ba63ea1d0afb049ea4 (patch) | |
tree | a5022a4c135c22522acbb1eb2136496157880e33 /src | |
parent | 25f9dcb6854c86fe4f84bcbe20e4bb65e61bf041 (diff) | |
download | coreboot-43d07f75cf001b49422470ba63ea1d0afb049ea4.tar.xz |
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
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34591
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-qlm.c index f7d631fb5b..b9552d4052 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 @@ int bdk_qlm_eye_display(bdk_node_t node, int qlm, int qlm_lane, int format, cons 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 */ |