drm/selftest: fix potential memleak in error branch
Subsystems (2)
PATCH 1/1 drm/selftest: fix potential memleak in error branch
This patch try to fix the potential memleak in error branch.
Signed-off-by Bernard Zhao <[email protected]>
--- drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c +4 -2
@@ -131,8 +131,10 @@ sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)return false; txmsg =kzalloc (sizeof (*txmsg),GFP_KERNEL ); -if (!txmsg) -return false; +if (!txmsg) { + result = false; + goto out; + }drm_dp_encode_sideband_req (in, txmsg); ret =drm_dp_decode_sideband_req (txmsg, out);
Signature · 1 line
2.33.1
I wonder what vivo's interested in this for!
Anyway:
Reviewed-by Lyude Paul <[email protected]>
Do you need me to push this to drm-misc-next for you?
Quoted 26 lines · Bernard Zhao
This patch try to fix the potential memleak in error branch.
Signed-off-by Bernard Zhao <[email protected]>---
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c | 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c +0
-0@@ -131,8 +131,10 @@ sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in) return false;
txmsg =kzalloc(sizeof(*txmsg), GFP_KERNEL); - if (!txmsg)
- return false;
+ if (!txmsg) {
+ result = false;
+ goto out;
+ }
drm_dp_encode_sideband_req(in, txmsg); ret =drm_dp_decode_sideband_req(txmsg, out);
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat