Skip to contentSkip to conversation

dibusb: fix possible memory leak in dibusb_rc_query()

PATCH New Wei Yongjun 1 participant 1 message Oct 30, 2016 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dibusb: fix possible memory leak in dibusb_rc_query()

From: Wei Yongjun <[email protected]>

'buf' is malloced in dibusb_rc_query() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak.

Fixes ff1c123545d7 ("[media] dibusb: handle error code on RC query")
---
 drivers/media/usb/dvb-usb/dibusb-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/dibusb-common.c +1 -1
index de3ee25..8207e69 100644
@@ -382,9 +382,9 @@ int dibusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 	if (buf[0] != 0)
 		deb_info("key: %*ph\n", 5, buf);
 
+ret:
 	kfree(buf);
 
-ret:
 	return ret;
 }
 EXPORT_SYMBOL(dibusb_rc_query);