Bug#730460: Acknowledgement (memory leak in procps-ng)

2013-11-25 Thread Jack Wang
Sorry, I need to correct my statement, the memory leak reported in
openproc instead of readproc.

 if (!src_buffer){
src_buffer = xmalloc(MAX_BUFSZ);
dst_buffer = xmalloc(MAX_BUFSZ);
}

src_buffer and dst_buffer never free.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#730460: Info received (Bug#730460: Acknowledgement (memory leak in procps-ng))

2013-11-25 Thread Jack Wang
Possible fix?
From b6cea36a762f7532873c5e1e35fc29564398f7e4 Mon Sep 17 00:00:00 2001
From: Fabian Holler fabian.hol...@profitbricks.com
Date: Mon, 25 Nov 2013 12:57:23 +0100
Subject: [PATCH] readproc: fix src_buffer and dst_buffer memory leaks

Jinpu Wang discovered that src_buffer and dst_buffer area allocated in
the openproc(..) function but never freed.
This commit fixes it by freeing the memory in the closeproc(..)
function.
---
 proc/readproc.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/proc/readproc.c b/proc/readproc.c
index e772298..6974baa 100644
--- a/proc/readproc.c
+++ b/proc/readproc.c
@@ -1199,6 +1199,11 @@ void closeproc(PROCTAB* PT) {
 memset(PT,'#',sizeof(PROCTAB));
 free(PT);
 }
+
+free(src_buffer);
+src_buffer = NULL;
+free(dst_buffer);
+dst_buffer = NULL;
 }

 // deallocate space allocated by readproc
-- 
1.7.2.5


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org