[SCSI] mpt fusion: fix two potential mem leaks
authorJesper Juhl <jesper.juhl@gmail.com>
Fri, 10 Aug 2007 21:50:51 +0000 (14:50 -0700)
committerJames Bottomley <jejb@mulgrave.localdomain>
Fri, 12 Oct 2007 18:47:13 +0000 (14:47 -0400)
commit568761955ad01c6d238d8b12d21a554c1226a37b
treef855ccc4944cf2646709db63452af6c35bbedc0c
parentd7383a234626b58dc6bc210ed806a6911c1f44e1
[SCSI] mpt fusion: fix two potential mem leaks

The Coverity checker spotted two potential memory leaks in
drivers/message/fusion/mptbase.c::mpt_attach().

There are two returns that may leak the storage allocated for 'ioc'
(sizeof(MPT_ADAPTER) bytes).

A simple fix would be to simply add two kfree() calls before the return
statements, but a better fix (that this patch implements) is to reorder the
code so that if we hit the first return condition we don't have to do the
allocation at all and then just add a kfree() call for the second case.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: "Moore, Eric Dean" <Eric.Moore@lsil.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/message/fusion/mptbase.c