mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxl: Use libxl__realloc in a couple of places in libxl_events.c
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>
This commit is contained in:
1 parent
f9ea792edc
commit
6281cacd1f
1 file changed
+3
-2
@@ -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; }
|
||||
|
||||
|
||||