[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xentop: fix potential memory leak



On a read failure the qstats buffer is not freed.

Signed-off-by: Charles Arnold <carnold@xxxxxxxx>

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);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.