Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754823AbbDTIdZ (ORCPT ); Mon, 20 Apr 2015 04:33:25 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:57447 "EHLO e06smtp15.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754608AbbDTIcQ (ORCPT ); Mon, 20 Apr 2015 04:32:16 -0400 Date: Mon, 20 Apr 2015 10:32:07 +0200 From: Martin Schwidefsky To: Christophe Jaillet Cc: heiko.carstens@de.ibm.com, linux390@de.ibm.com, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] s390: char: con3215: Free memory in error path Message-ID: <20150420103207.7491723c@mschwide> In-Reply-To: <1429449456-4050-1-git-send-email-christophe.jaillet@wanadoo.fr> References: <1429449456-4050-1-git-send-email-christophe.jaillet@wanadoo.fr> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15042008-0021-0000-0000-000003A1F194 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1171 Lines: 37 On Sun, 19 Apr 2015 15:17:36 +0200 Christophe Jaillet wrote: > If one memory allocation fails, there is a memory leak. > > Signed-off-by: Christophe Jaillet > --- > drivers/s390/char/con3215.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c > index c43aca6..0fc3fe5 100644 > --- a/drivers/s390/char/con3215.c > +++ b/drivers/s390/char/con3215.c > @@ -667,6 +667,8 @@ static struct raw3215_info *raw3215_alloc_info(void) > info->buffer = kzalloc(RAW3215_BUFFER_SIZE, GFP_KERNEL | GFP_DMA); > info->inbuf = kzalloc(RAW3215_INBUF_SIZE, GFP_KERNEL | GFP_DMA); > if (!info->buffer || !info->inbuf) { > + kfree(info->inbuf); > + kfree(info->buffer); > kfree(info); > return NULL; > } Applied, thanks. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/