mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers/char/pcmcia/ipwireless/hardware.c fix resource leak
@ 2008-07-06 22:18 Darren Jenkins\
  2008-07-07 12:49 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Jenkins\ @ 2008-07-06 22:18 UTC (permalink / raw)
  To: kernel Janitors, LKML, jkosina, dsterba

G'day people,

Coverity CID: 2172 RESOURCE_LEAK

When pool_allocate() tries to enlarge a packet, if it can not allocate
enough memory, it returns NULL without first freeing the old packet.

This patch just frees the packet first.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>

diff --git a/drivers/char/pcmcia/ipwireless/hardware.c b/drivers/char/pcmcia/ipwireless/hardware.c
index ba6340a..929101e 100644
--- a/drivers/char/pcmcia/ipwireless/hardware.c
+++ b/drivers/char/pcmcia/ipwireless/hardware.c
@@ -590,8 +590,10 @@ static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
 		packet = kmalloc(sizeof(struct ipw_rx_packet) +
 				old_packet->length + minimum_free_space,
 				GFP_ATOMIC);
-		if (!packet)
+		if (!packet) {
+			kfree(old_packet);
 			return NULL;
+		}
 		memcpy(packet, old_packet,
 				sizeof(struct ipw_rx_packet)
 					+ old_packet->length);
 


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

end of thread, other threads:[~2008-07-07 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-06 22:18 [PATCH] drivers/char/pcmcia/ipwireless/hardware.c fix resource leak Darren Jenkins\
2008-07-07 12:49 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®