From patchwork Tue Aug 11 06:37:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentin Corfu X-Patchwork-Id: 6989301 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C3DD29F39D for ; Tue, 11 Aug 2015 06:39:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CFDC7205FA for ; Tue, 11 Aug 2015 06:39:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9B16E205F7 for ; Tue, 11 Aug 2015 06:39:20 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A0CCE265D57; Tue, 11 Aug 2015 08:39:19 +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.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A6A542604BD; Tue, 11 Aug 2015 08:39:10 +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 BDA622604BE; Tue, 11 Aug 2015 08:39:09 +0200 (CEST) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by alsa0.perex.cz (Postfix) with ESMTP id C941D2604A1 for ; Tue, 11 Aug 2015 08:39:03 +0200 (CEST) Received: by wijp15 with SMTP id p15so162741041wij.0 for ; Mon, 10 Aug 2015 23:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Sp1YflqMTL0pULb2PKN0/CN5i2Ae2SklUxL8B/V8vdc=; b=LRTC1lYThqtjgn36XOTDDnwP1f97eBH1PZ2UeSON4GrWIhxiPH61A0OG66+uWnlmZo r2YWWMOcEmosH9sIQb4PDO+qYfG/igIxR4+UMcMrongZjSQ4gRLCq70pp7a7R2VwdQwJ thNqHUkyL2F4MQY9sjoUCGnasEcX4vSo4zDw4EPxwf/LAXdbk9hf1HwuTMc3hoDde3DV ES0UMpUV9kVbjyYqtvZtvyORsle+gadAVDL2Nc9Shhhd6QsEH82ZF9FrC4o6dS7qxbdg k166Edu0V9fXYxQPfLL7+FPUvC3Z3hl/dOtqYuDDqJhnRYNXPGOiCwwQNmDtSD+dnb6O q8Vw== X-Received: by 10.180.103.132 with SMTP id fw4mr10169641wib.52.1439275143518; Mon, 10 Aug 2015 23:39:03 -0700 (PDT) Received: from otp-vcorfu-l1.corp.ad.wrs.com ([89.121.200.106]) by smtp.googlemail.com with ESMTPSA id s5sm17324001wik.2.2015.08.10.23.39.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Aug 2015 23:39:02 -0700 (PDT) From: Valentin Corfu To: alsa-devel@alsa-project.org Date: Tue, 11 Aug 2015 09:37:14 +0300 Message-Id: <1439275034-577-1-git-send-email-corfuvalentin@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: Valentin Corfu Subject: [alsa-devel] [PATCH] 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP A small memory leak can be observed when using alsa-plugins (jack). Check the following valgrind log: ... ==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 ... Signed-off-by: Valentin Corfu --- jack/pcm_jack.c | 1 + 1 file changed, 1 insertion(+) diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c index 568ec43..de9c46e 100644 --- a/jack/pcm_jack.c +++ b/jack/pcm_jack.c @@ -103,6 +103,7 @@ static void snd_pcm_jack_free(snd_pcm_jack_t *jack) if (jack->io.poll_fd >= 0) close(jack->io.poll_fd); free(jack->areas); + free(jack->ports); free(jack); } }