From patchwork Mon Aug 10 15:07:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 6985311 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 43647C05AC for ; Mon, 10 Aug 2015 15:08:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3483720381 for ; Mon, 10 Aug 2015 15:08:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E0C132024F for ; Mon, 10 Aug 2015 15:08:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 038E32659CE; Mon, 10 Aug 2015 17:08:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 8E387265993; Mon, 10 Aug 2015 17:07:57 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D7594265998; Mon, 10 Aug 2015 17:07:55 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BFA39265993 for ; Mon, 10 Aug 2015 17:07:49 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8BF87AAC2; Mon, 10 Aug 2015 15:07:49 +0000 (UTC) Date: Mon, 10 Aug 2015 17:07:49 +0200 Message-ID: From: Takashi Iwai To: Valentin Corfu In-Reply-To: <1439218706-30721-1-git-send-email-corfuvalentin@gmail.com> References: <1439218706-30721-1-git-send-email-corfuvalentin@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] jack: Fixing a small memory leak X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, 10 Aug 2015 16:58:25 +0200, Valentin Corfu wrote: > > > Hello Alsa developers, > > I observed a small memory leak in alsa-plugins (jack): > > ... > ==1034== > ==1034== 8 bytes in 1 blocks are definitely lost in loss record 7 of 108 > ==1034== at 0x4027E5A: calloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) > ==1034== by 0x4035102: snd_pcm_jack_prepare (in /usr/lib/alsa-lib/libasound_module_pcm_jack.so) > ==1034== by 0x40D07AB: snd_pcm_ioplug_prepare (pcm_ioplug.c:145) > ==1034== by 0x4084961: snd_pcm_prepare (pcm.c:1052) > ==1034== by 0x409DDB4: snd_pcm_plugin_prepare (pcm_plugin.c:162) > ==1034== by 0x4084961: snd_pcm_prepare (pcm.c:1052) > ==1034== by 0x409DDB4: snd_pcm_plugin_prepare (pcm_plugin.c:162) > ==1034== by 0x4084961: snd_pcm_prepare (pcm.c:1052) > ==1034== by 0x4084A1D: snd_pcm_hw_params (pcm.c:838) > ==1034== by 0x4090013: snd_pcm_set_params (pcm.c:8053) > ==1034== by 0x80486EB: main (in /root/pcm_min_ok) > ... > ==1034== LEAK SUMMARY: > ==1034== definitely lost: 8 bytes in 1 blocks > ==1034== indirectly lost: 0 bytes in 0 blocks > ==1034== possibly lost: 31,311 bytes in 1,630 blocks > ==1034== still reachable: 5,619 bytes in 24 blocks > ==1034== suppressed: 0 bytes in 0 blocks > ==1034== Reachable blocks (those to which a pointer was found) are not shown. > ==1034== To see them, rerun with: --leak-check=full --show-leak-kinds=all > ... Does the patch below fix it? Takashi diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c index 568ec43b0924..4134f9e6498e 100644 --- a/jack/pcm_jack.c +++ b/jack/pcm_jack.c @@ -102,6 +102,7 @@ static void snd_pcm_jack_free(snd_pcm_jack_t *jack) close(jack->fd); if (jack->io.poll_fd >= 0) close(jack->io.poll_fd); + free(jack->ports); free(jack->areas); free(jack); }