[PATCH] iSeries: Don't leak if allocations fail in mf_getSrcHistory

Michael Ellerman michael at ellerman.id.au
Mon Nov 1 22:10:42 EST 2010


On Sat, 2010-10-30 at 19:20 +0200, Jesper Juhl wrote:
> Hi,
> 
> If memory is tight and a dynamic allocation fails there's no reason to 
> make a bad situation worse by leaking memory.
> 
> mf_getSrcHistory potentially leaks pages[0-3]. I believe the right thing 
> to do is to free that memory again before returning -ENOMEM - which is 
> what this patch does.
> 
> I realize that the function is under '#if 0' so this probably doesn't 
> matter much, but I assume that the function is still there for a reason 
> (but I could be wrong, I don't know the powerpc code).
> Anyway, I suggest we remove the leak.

Stephen is the iSeries maintainer, and I think he #if 0'ed the code. But
I don't think it will ever be un-ifdef'ed, so should probably just be
removed.

cheers

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20101101/ce044b82/attachment.pgp>


More information about the Linuxppc-dev mailing list