usb: dev-mtp: fix memory leak in error path
PATCH 1/1 usb: dev-mtp: fix memory leak in error path
Spotted by Coverity: CID 1397074
Signed-off-by Li Qiang <[email protected]>
--- hw/usb/dev-mtp.c | 1 + 1 file changed, 1 insertion(+)
hw/usb/dev-mtp.c +1 -0
@@ -1729,6 +1729,7 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen)if (strchr (filename,'/' )) {usb_mtp_queue_result (s,RES_PARAMETER_NOT_SUPPORTED , d->trans,0 ,0 ,0 ,0 ); +g_free (filename);return ; }
Signature · 1 line
2.17.1
Quoted 2 lines · Li Qiang
Spotted by Coverity: CID 1397074
Gerd, if you take this, can you add:
Fixes c52d46e041b
Quoted 1 line
Signed-off-by Li Qiang <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 17 lines
--- hw/usb/dev-mtp.c | 1 + 1 file changed, 1 insertion(+)hw/usb/dev-mtp.c +1
-0@@ -1729,6 +1729,7 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen)if (strchr (filename,'/' )) {usb_mtp_queue_result (s,RES_PARAMETER_NOT_SUPPORTED , d->trans,0 ,0 ,0 ,0 ); +g_free (filename);return ; }
Li Qiang
Reviewed-by Philippe Mathieu-DaudéOh, sorry, I always forget to add this “Fixs: xxx” for these small issues.
Thanks,
Li Qiang
发件人: Philippe Mathieu-Daudé
发送时间: 2019年1月3日 21:38
收件人: Li Qiang; [email protected]
抄送: [email protected]; [email protected]
主题: Re: [Qemu-devel] [PATCH] usb: dev-mtp: fix memory leak in error path
Quoted 2 lines · Li Qiang
Spotted by Coverity: CID 1397074
Gerd, if you take this, can you add:
Fixes c52d46e041b
Quoted 1 line
Signed-off-by Li Qiang <[email protected]>
Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Quoted 17 lines
--- hw/usb/dev-mtp.c | 1 + 1 file changed, 1 insertion(+)hw/usb/dev-mtp.c +1
-0@@ -1729,6 +1729,7 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen)if (strchr (filename,'/' )) {usb_mtp_queue_result (s,RES_PARAMETER_NOT_SUPPORTED , d->trans,0 ,0 ,0 ,0 ); +g_free (filename);return ; }
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 2 lines · Li Qiang
Spotted by Coverity: CID 1397074
Gerd, if you take this, can you add:
Fixes c52d46e041b
Done. Thanks for looking up.
cheers,
Gerd