On Wednesday 08 October 2014 08:44 AM, Tuukka Tikkanen wrote:
Hi,

On Wed, Sep 17, 2014 at 1:20 PM, Sanjay Singh Rawat
<sanjay.ra...@linaro.org> wrote:
Signed-off-by: Sanjay Singh Rawat <sanjay.ra...@linaro.org>
---

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);
Are you sure about wakeirq? To me it looks like we should not free
using this pointer. The consistent lack of comments in the source is
not very helpful here, but it looks like a active record pointer
rather than start of allocated memory area pointer.

ack. Thanks for the review Tuukka, updating the patch.

Tuukka

+
         /* free the cstates array */
         free(cstates);
  }
--
1.8.3.2


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

--
sanjay


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to