From: Jean Delvare Date: Tue, 13 Mar 2012 16:52:50 +0000 (-0300) Subject: [media] dib0700: Fix memory leak during initialization X-Git-Tag: firefly_0821_release~3680^2~275^2~2581 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d3db22e10bd4997d244beee6feea5fa39b2e5b82;p=firefly-linux-kernel-4.4.55.git [media] dib0700: Fix memory leak during initialization Reported by kmemleak. Signed-off-by: Jean Delvare Cc: Mauro Carvalho Chehab Cc: Devin Heitmueller Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index ae4f999930fa..02290c60f72f 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -679,6 +679,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) deb_info("%s()\n", __func__); if (d->rc_dev == NULL) { /* This will occur if disable_rc_polling=1 */ + kfree(purb->transfer_buffer); usb_free_urb(purb); return; } @@ -687,6 +688,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) if (purb->status < 0) { deb_info("discontinuing polling\n"); + kfree(purb->transfer_buffer); usb_free_urb(purb); return; } @@ -781,8 +783,11 @@ int dib0700_rc_setup(struct dvb_usb_device *d) dib0700_rc_urb_completion, d); ret = usb_submit_urb(purb, GFP_ATOMIC); - if (ret) + if (ret) { err("rc submit urb failed\n"); + kfree(purb->transfer_buffer); + usb_free_urb(purb); + } return ret; }