]> git.karo-electronics.de Git - mv-sheeva.git/commit
Broadcom CNIC core network driver: fix mem leak on allocation failures in cnic_alloc_...
authorJesper Juhl <jj@chaosbits.net>
Fri, 31 Dec 2010 19:18:48 +0000 (11:18 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Dec 2010 19:18:48 +0000 (11:18 -0800)
commitf7e4c9775ea648deed4a8193951e50d0c7706173
tree552432919518946318a2fcec90365f4f5006cf8e
parent2393c944d5d60eedaede80273ede8a816b5fa3e0
Broadcom CNIC core network driver: fix mem leak on allocation failures in cnic_alloc_uio_rings()

We are leaking memory in drivers/net/cnic.c::cnic_alloc_uio_rings() if
either of the calls to dma_alloc_coherent() fail. This patch fixes it by
freeing both the memory allocated with kzalloc() and memory allocated with
previous calls to dma_alloc_coherent() when there's a failure.

Thanks to  Joe Perches <joe@perches.com>  for suggesting a better
implementation than my initial version.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cnic.c