]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: fix memory leaks in phram_setup
authorJesper Juhl <jesper.juhl@gmail.com>
Sat, 13 May 2006 23:07:18 +0000 (01:07 +0200)
committerDavid Woodhouse <dwmw2@infradead.org>
Sat, 13 May 2006 23:13:30 +0000 (00:13 +0100)
commit28c4be4c7d903ae976aa6ccb1a86918de1747a41
tree136a3406bf5b0e80b3d45cd4d3c6ca40bb9961fd
parente1ac7ab60fc15ff50658d51c4dcc646898c6ae71
mtd: fix memory leaks in phram_setup

There are two code paths in drivers/mtd/devices/phram.c::phram_setup() that
will leak memory.
Memory is allocated to the variable 'name' with kmalloc() by the
parse_name() function, but if we leave by way of the parse_err() macro,
then that memory is never kfree()'d, nor is it ever used with
register_device() so it won't be freed later either - leak.

Found by the Coverity checker as #593 - simple fix below.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/devices/phram.c