* [PATCH] [media] hdpvr: Fix memory leak in debug
@ 2014-01-17 16:38 Masanari Iida
0 siblings, 0 replies; only message in thread
From: Masanari Iida @ 2014-01-17 16:38 UTC (permalink / raw)
To: m.chehab, linux-media, linux-kernel, hverkuil; +Cc: Masanari Iida
cppcheck reported memory leak in device_authorizatio()
within hdpvr-core.c.
When the debug option is specified and the code jump to
"unlock:" label, print_buf was not freed.
Confirm the module succesfully compiled without error.
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
---
drivers/media/usb/hdpvr/hdpvr-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
index 2f0c89c..c563896 100644
--- a/drivers/media/usb/hdpvr/hdpvr-core.c
+++ b/drivers/media/usb/hdpvr/hdpvr-core.c
@@ -198,7 +198,6 @@ static int device_authorization(struct hdpvr_device *dev)
hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n",
print_buf);
- kfree(print_buf);
#endif
msleep(100);
@@ -214,6 +213,9 @@ static int device_authorization(struct hdpvr_device *dev)
retval = ret != 8;
unlock:
mutex_unlock(&dev->usbc_mutex);
+#ifdef HDPVR_DEBUG
+ kfree(print_buf);
+#endif
return retval;
}
--
1.8.5.2.309.ga25014b
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-17 16:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-17 16:38 [PATCH] [media] hdpvr: Fix memory leak in debug Masanari Iida
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).