libxl: Use libxl__realloc in a couple of places in libxl_events.c
authorIan Campbell <ian.campbell@citrix.com>
Thu, 25 Oct 2012 16:05:29 +0000 (17:05 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 25 Oct 2012 16:05:29 +0000 (17:05 +0100)
This avoids us having to think about the error handling on failure.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_event.c

index e9e2fdc27731a91eec0ab3dceff0935ff7f1f72c..41fd5bbfe6d0ddf44b787f6f44bbf18038a40b0e 100644 (file)
@@ -489,7 +489,8 @@ int libxl__ev_xswatch_register(libxl__gc *gc, libxl__ev_xswatch *w,
         int newarraysize = (CTX->watch_nslots + 1) << 2;
         int i;
         libxl__ev_watch_slot *newarray =
-            realloc(CTX->watch_slots, sizeof(*newarray) * newarraysize);
+            libxl__realloc(NOGC,
+                           CTX->watch_slots, sizeof(*newarray) * newarraysize);
         if (!newarray) goto out_nomem;
         for (i = CTX->watch_nslots; i < newarraysize; i++)
             LIBXL_SLIST_INSERT_HEAD(&CTX->watch_freeslots,
@@ -1343,7 +1344,7 @@ static int eventloop_iteration(libxl__egc *egc, libxl__poller *poller) {
 
         struct pollfd *newarray =
             (nfds > INT_MAX / sizeof(struct pollfd) / 2) ? 0 :
-            realloc(poller->fd_polls, sizeof(*newarray) * nfds);
+            libxl__realloc(NOGC, poller->fd_polls, sizeof(*newarray) * nfds);
 
         if (!newarray) { rc = ERROR_NOMEM; goto out; }