From patchwork Wed Sep 17 10:20:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 37514 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1653B2054D for ; Wed, 17 Sep 2014 10:20:19 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id x12sf680656wgg.2 for ; Wed, 17 Sep 2014 03:20:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=BETwN4PQS6ONFwvzgCuM8sVV/EhUG9b3AKDRWSAzZZo=; b=dOM8dw9zI7fUJhyv2EgEhluVZlGEZBLqjMinngdoG75oxgKDKsiYvplZP2IV8YQQd4 GzPDow1Ugy1H+eS6CbY97maEfY7VtCV4y/rG85qfNKeDXE69cRtd5KGzAyPP3x2ZJsSu 0f3sLOg0qqzlx1tbaS6gv7XdYZUNoQcXMXD340Ds4DbBiVbkZrfywnDke7XJoqzHB9Kr DJc38pBF8cnYhQVoBFJvOSRRpQpQ/cPAENSOthU6P0oUas/8HnmgDhGmU76Hxpgu57m7 3BY3Yn5wZ/6L82XeGUbA3w3pQMBJrfplSdKw5SaI91wU43HmRnBoo8fDnxsOQ8sg3Jkx GZzQ== X-Gm-Message-State: ALoCoQnwC3Kjp9GZCceFf21Ukqp+0G2ID2Q20rQg6qBcmR8tFmCI/UbBbBuSrgN1KDYx3vyl386z X-Received: by 10.180.73.79 with SMTP id j15mr7608153wiv.4.1410949218003; Wed, 17 Sep 2014 03:20:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.104 with SMTP id lf8ls83023lac.87.gmail; Wed, 17 Sep 2014 03:20:17 -0700 (PDT) X-Received: by 10.112.38.107 with SMTP id f11mr2717943lbk.18.1410949217653; Wed, 17 Sep 2014 03:20:17 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id q13si8474059lal.108.2014.09.17.03.20.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 03:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id z12so369633lbi.36 for ; Wed, 17 Sep 2014 03:20:17 -0700 (PDT) X-Received: by 10.112.75.233 with SMTP id f9mr1920317lbw.102.1410949217590; Wed, 17 Sep 2014 03:20:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.130.169 with SMTP id of9csp548474lbb; Wed, 17 Sep 2014 03:20:16 -0700 (PDT) X-Received: by 10.67.4.1 with SMTP id ca1mr58143479pad.50.1410949216149; Wed, 17 Sep 2014 03:20:16 -0700 (PDT) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id z3si18988044pbw.195.2014.09.17.03.20.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 03:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of sanjay.rawat@linaro.org designates 209.85.192.170 as permitted sender) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id fp1so1850510pdb.29 for ; Wed, 17 Sep 2014 03:20:15 -0700 (PDT) X-Received: by 10.70.140.193 with SMTP id ri1mr65235238pdb.18.1410949214989; Wed, 17 Sep 2014 03:20:14 -0700 (PDT) Received: from ubuntu5e03.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id k8sm16487356pdo.64.2014.09.17.03.20.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 03:20:14 -0700 (PDT) From: Sanjay Singh Rawat To: linaro-dev@lists.linaro.org Cc: amit.kucheria@linaro.org, daniel.lezcano@linaro.org, Sanjay Singh Rawat Subject: [PATCH IDLESTAT] clear few memory leaks Date: Wed, 17 Sep 2014 15:50:40 +0530 Message-Id: <1410949240-22540-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Sanjay Singh Rawat --- below are the leaks which this patch clears 72 bytes in 3 blocks are definitely lost in loss record 2 of 9 at 0x4C2ABBD: malloc (vg_replace_malloc.c:296) by 0x4C2CA8B: realloc (vg_replace_malloc.c:692) by 0x403636: store_data (idlestat.c:836) 72 bytes in 2 blocks are definitely lost in loss record 4 of 9 at 0x4C2CB0A: realloc (vg_replace_malloc.c:692) by 0x403820: store_irq (idlestat.c:882) 32,136 bytes in 9 blocks are definitely lost in loss record 9 of 9 at 0x4C2CB0A: realloc (vg_replace_malloc.c:692) by 0x403636: store_data (idlestat.c:836) by 0x403E2D: idlestat_load (idlestat.c:1015) --- idlestat.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/idlestat.c b/idlestat.c index da615cb..4d38d57 100644 --- a/idlestat.c +++ b/idlestat.c @@ -459,9 +459,16 @@ static void release_cstate_info(struct cpuidle_cstates *cstates, int nrcpus) struct cpuidle_cstate *c = &(cstates[cpu].cstate[i]); if (c->name) free(c->name); + if (c->data) + free(c->data); } } + if (cstates->wakeinfo.irqinfo) + free(cstates->wakeinfo.irqinfo); + if (cstates->wakeirq) + free(cstates->wakeirq); + /* free the cstates array */ free(cstates); }