Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43f77e91 authored by Darren Jenkins's avatar Darren Jenkins Committed by Linus Torvalds
Browse files

drivers/char/pcmcia/ipwireless/hardware.c fix resource leak



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: default avatarDarren Jenkins <darrenrjenkins@gmail.com>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent a26929fb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);