Skip to content

Commit

Permalink
[media] hdpvr: Fix memory leak in debug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Masanari Iida authored and Mauro Carvalho Chehab committed Feb 4, 2014
1 parent f2e4c5e commit 1ba6c90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/usb/hdpvr/hdpvr-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 1ba6c90

Please sign in to comment.