• Jesper Juhl's avatar
    mtd: fix memory leaks in phram_setup · 4f678a58
    Jesper Juhl authored
    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: default avatarJesper Juhl <jesper.juhl@gmail.com>
    Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
    4f678a58
phram.c 5.69 KB