consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c
authorGen Zhang <blackgod016574@gmail.com>
Thu, 23 May 2019 00:34:52 +0000 (08:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 24 May 2019 08:04:44 +0000 (10:04 +0200)
commit84ecc2f6eb1cb12e6d44818f94fa49b50f06e6ac
treee83742a61aa97de1836e24e3b88dd3b562967fe2
parent06aaa3d066db87e8478522d910285141d44b1e58
consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c

In function con_insert_unipair(), when allocation for p2 and p1[n]
fails, ENOMEM is returned, but previously allocated p1 is not freed,
remains as leaking memory. Thus we should free p1 as well when this
allocation fails.

Signed-off-by: Gen Zhang <blackgod016574@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/vt/consolemap.c