From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753329Ab1AJKPX (ORCPT ); Mon, 10 Jan 2011 05:15:23 -0500 Received: from cantor2.suse.de ([195.135.220.15]:41930 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751962Ab1AJKPW (ORCPT ); Mon, 10 Jan 2011 05:15:22 -0500 Date: Mon, 10 Jan 2011 11:15:21 +0100 Message-ID: From: Takashi Iwai To: Jesper Juhl Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jaroslav Kysela Subject: Re: [PATCH] Don't leak in sound/core/oss/pcm_oss.c::snd_pcm_hw_param_near() In-Reply-To: References: User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 6 Jan 2011 22:19:47 +0100 (CET), Jesper Juhl wrote: > > > snd_pcm_hw_param_near() will leak the memory allocated to 'save' if the > call to snd_pcm_hw_param_max() returns less than zero. > This patch makes sure we never leak. > > Signed-off-by: Jesper Juhl Applied now. Thanks. Takashi > --- > pcm_oss.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c > index b753ec6..a2e4eb3 100644 > --- a/sound/core/oss/pcm_oss.c > +++ b/sound/core/oss/pcm_oss.c > @@ -453,8 +453,10 @@ static int snd_pcm_hw_param_near(struct snd_pcm_substream *pcm, > } else { > *params = *save; > max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir); > - if (max < 0) > + if (max < 0) { > + kfree(save); > return max; > + } > last = 1; > } > _end: > > > > -- > Jesper Juhl http://www.chaosbits.net/ > Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html > Plain text mails only, please. >