From: Charles Arnold Date: Thu, 2 Apr 2015 15:42:02 +0000 (-0600) Subject: xentop: fix potential memory leak X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3461 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f4d2d0e9a2159154e327a3f05b467824ae5e9e15;p=xen.git xentop: fix potential memory leak On a read failure the qstats buffer is not freed. Signed-off-by: Charles Arnold Acked-by: Ian Campbell --- diff --git a/tools/xenstat/libxenstat/src/xenstat_qmp.c b/tools/xenstat/libxenstat/src/xenstat_qmp.c index c217b8e78b..2cb99e9a60 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);