]> git.baikalelectronics.ru Git - kernel.git/commit
[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)
commitec4666fb1aa15a26869abe7ed16ad6710c1101e6
treef855ccc4944cf2646709db63452af6c35bbedc0c
parentc7ea0024f165fd92c93b8f7ccec9a50de16d5c4c
[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