All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2 -next] hid-lg4ff: add a kfree() to an error path
@ 2011-08-18 13:43 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2011-08-18 13:43 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: open list:HID CORE LAYER, kernel-janitors

There is a small rare potential memory leak here.  But it's easy to
fix.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/hid/hid-lg4ff.c b/drivers/hid/hid-lg4ff.c
index dc38c2d..2b4bbcb 100644
--- a/drivers/hid/hid-lg4ff.c
+++ b/drivers/hid/hid-lg4ff.c
@@ -438,6 +438,7 @@ int lg4ff_init(struct hid_device *hid)
 	entry->device_id = (char *)kzalloc(strlen((&hid->dev)->kobj.name) + 1, GFP_KERNEL);
 	if (!entry->device_id) {
 		hid_err(hid, "Cannot set device_id, insufficient memory.\n");
+		kfree(entry);
 		return -ENOMEM;
 	}
 	strcpy(entry->device_id, (&hid->dev)->kobj.name);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-08-23  8:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18 13:43 [patch 2/2 -next] hid-lg4ff: add a kfree() to an error path Dan Carpenter
2011-08-18 13:43 ` Dan Carpenter
     [not found] ` <CAMvewQJigdY81gPrpndqV=FxN+cEeif4NkzSbBZKCO4z3guQew@mail.gmail.com>
2011-08-18 16:24   ` Dan Carpenter
2011-08-18 16:24     ` Dan Carpenter
     [not found] ` <4E4D2E4A.3020205@bfs.de>
2011-08-19  8:00   ` [patch 2/2 -next v2] " Dan Carpenter
2011-08-19  8:00     ` Dan Carpenter
2011-08-23  8:46     ` Jiri Kosina
2011-08-23  8:46       ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.