All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xentop: fix potential memory leak
@ 2015-04-02 15:42 Charles Arnold
  2015-04-02 15:56 ` Ian Campbell
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Arnold @ 2015-04-02 15:42 UTC (permalink / raw)
  To: xen-devel; +Cc: IanCampbell, ian.campbell

On a read failure the qstats buffer is not freed.

Signed-off-by: Charles Arnold <carnold@suse.com>

diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c
index c217b8e..2cb99e9 100644
--- a/tools/xenstat/libxenstat/src/xenstat_qmp.c
+++ b/tools/xenstat/libxenstat/src/xenstat_qmp.c
@@ -298,6 +298,7 @@ static int qmp_read(int qfd, unsigned char **qstats)
 	while ((n = poll(pfd, POLLIN, 10)) > 0) {
 		if (pfd[0].revents & POLLIN) {
 			if ((n = read(qfd, buf, sizeof(buf))) < 0) {
+				free(*qstats);
 				return 0;
 			}
 			ptr = realloc(*qstats, qsize+n+1);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xentop: fix potential memory leak
  2015-04-02 15:42 [PATCH] xentop: fix potential memory leak Charles Arnold
@ 2015-04-02 15:56 ` Ian Campbell
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Campbell @ 2015-04-02 15:56 UTC (permalink / raw)
  To: Charles Arnold; +Cc: xen-devel

On Thu, 2015-04-02 at 09:42 -0600, Charles Arnold wrote:
> On a read failure the qstats buffer is not freed.
> 
> Signed-off-by: Charles Arnold <carnold@suse.com>

Acked + applied, thanks for the quick response!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-02 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-02 15:42 [PATCH] xentop: fix potential memory leak Charles Arnold
2015-04-02 15:56 ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.