Re: [PATCH v2] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c

2019-05-24 Thread Kees Cook
On Fri, May 24, 2019 at 10:37:59AM +0100, Jon Hunter wrote: > Kees, > > On 23/05/2019 17:54, Kees Cook wrote: > > On Thu, May 23, 2019 at 08:34:52AM +0800, Gen Zhang wrote: > >> In function con_insert_unipair(), when allocation for p2 and p1[n] > >> fails, ENOMEM is returned, but previously alloca

Re: [PATCH v2] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c

2019-05-24 Thread Jon Hunter
Kees, On 23/05/2019 17:54, Kees Cook wrote: > On Thu, May 23, 2019 at 08:34:52AM +0800, Gen Zhang wrote: >> 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

Re: [PATCH v2] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c

2019-05-23 Thread Gen Zhang
On Thu, May 23, 2019 at 09:54:18AM -0700, Kees Cook wrote: > On Thu, May 23, 2019 at 08:34:52AM +0800, Gen Zhang wrote: > > 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. Thu

Re: [PATCH v2] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c

2019-05-23 Thread Kees Cook
On Thu, May 23, 2019 at 08:34:52AM +0800, Gen Zhang wrote: > 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. > > Sign

[PATCH v2] consolemap: Fix a memory leaking bug in drivers/tty/vt/consolemap.c

2019-05-22 Thread Gen Zhang
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 --- diff --git a/drivers/tty/vt/consolemap.c b/dr