Skip to content

Commit

Permalink
usb: dwc3: debugfs: add a kfree() on error to dwc3_testmode_open()
Browse files Browse the repository at this point in the history
We may as well fix this potential leak so we don't have to listen to
the static checkers complain.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Dan Carpenter authored and Felipe Balbi committed Sep 9, 2011
1 parent 0156cf8 commit b4f28a9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/dwc3/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,10 @@ static int dwc3_testmode_open(struct inode *inode, struct file *file)
if (!buf0)
return -ENOMEM;
buf1 = kmalloc(BUF_SIZE, GFP_KERNEL);
if (!buf1)
if (!buf1) {
kfree(buf0);
return -ENOMEM;
}

memset(buf0, 0xaa, BUF_SIZE);
memset(buf1, 0x33, BUF_SIZE);
Expand Down

0 comments on commit b4f28a9

Please sign in to comment.