]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: don't leak memory in libxl__poller_get failure case
authorMatthew Daley <mattjd@gmail.com>
Wed, 30 Oct 2013 07:51:53 +0000 (20:51 +1300)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 12 Aug 2015 12:09:54 +0000 (13:09 +0100)
Coverity-ID: 1055894
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
(cherry picked from commit 1edd6d8da354442b860ae28b8944dbd8a102d5f7)
(cherry picked from commit e9a0fc5998917b4c77067fa35b16eee4185ca2fa)

tools/libxl/libxl_event.c

index 81bb4885a29ae37844797000f384ce361a9315db..f3c1019265e0bc6ae22fd1d102da6e5141feca81 100644 (file)
@@ -1339,7 +1339,10 @@ libxl__poller *libxl__poller_get(libxl_ctx *ctx)
     memset(p, 0, sizeof(*p));
 
     rc = libxl__poller_init(ctx, p);
-    if (rc) return NULL;
+    if (rc) {
+        free(p);
+        return NULL;
+    }
 
     return p;
 }