coredump: format_corename() can leak cn->corename
coredump: format_corename() can leak cn->corename

do_coredump() assumes that format_corename() can only fail if
expand_corename() fails and frees cn->corename.  This is not true, for
example cn_print_exe_file() can fail and in this case nobody frees
cn->corename.

Change do_coredump() to always do kfree(cn->corename) after it calls
format_corename() (NULL is fine), change expand_corename() to do nothing
if kmalloc() fails.

Signed-off-by: Oleg Nesterov <20b70f0af00562e63758b9ee42012ecc96c58590@redhat.com>
Cc: Andi Kleen <dbd122ef7b6a09ffecf5db9c9296320f3c94e707@firstfloor.org>
Cc: Colin Walters <694ce38231ed622bd1593ce4ec9aa85c9ddb0a78@verbum.org>
Cc: Denys Vlasenko <42afb3a19136e88700e8b77002ea6a5a94c16782@googlemail.com>
Cc: Jiri Slaby <dfbf39eb5bf303a3db5454d815cb8c8888cbadf9@suse.cz>
Cc: Lennart Poettering <fad0d8f485431a55e73d752ce6eb98ea934195c9@0pointer.de>
Cc: Lucas De Marchi <581e16d94f08e10a8f83ee80538c8d517dd41eff@gmail.com>
Acked-by: Neil Horman <3316dc2d77df57653443c0391a5296176d6ca9c3@tuxdriver.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs