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 Campbell <ian.campbell@citrix.com>
Thu, 31 Oct 2013 21:55:52 +0000 (21:55 +0000)
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>
tools/libxl/libxl_event.c

index c5e942616b68b4a498bb6687d0ecfe88c478117d..0fe44288f495c40bc973673af46775aea24d9a6c 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;
 }