summaryrefslogtreecommitdiff
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorMasanari Iida <standby24x7@gmail.com>2014-01-17 16:38:00 (GMT)
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-02-04 08:43:53 (GMT)
commit1ba6c90161ac058f580e6ceb5ccc14dcd86365d1 (patch)
treec78403a862d45fb4939398375380be5b7c6828f5 /drivers/media/usb
parentf2e4c5e004691dfe37d0e4b363296f28abdb9bc7 (diff)
downloadlinux-1ba6c90161ac058f580e6ceb5ccc14dcd86365d1.tar.xz
[media] hdpvr: Fix memory leak in debug
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> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-core.c4
1 files changed, 3 insertions, 1 deletions
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;
}