Commit 1ba6c901 authored by Masanari Iida's avatar Masanari Iida Committed by Mauro Carvalho Chehab

[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: default avatarMasanari Iida <standby24x7@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent f2e4c5e0
...@@ -198,7 +198,6 @@ static int device_authorization(struct hdpvr_device *dev) ...@@ -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); 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", v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n",
print_buf); print_buf);
kfree(print_buf);
#endif #endif
msleep(100); msleep(100);
...@@ -214,6 +213,9 @@ static int device_authorization(struct hdpvr_device *dev) ...@@ -214,6 +213,9 @@ static int device_authorization(struct hdpvr_device *dev)
retval = ret != 8; retval = ret != 8;
unlock: unlock:
mutex_unlock(&dev->usbc_mutex); mutex_unlock(&dev->usbc_mutex);
#ifdef HDPVR_DEBUG
kfree(print_buf);
#endif
return retval; return retval;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment