From 1e4b22a9f579cd53a4aa17caedf04d06fe965feb Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sat, 8 Feb 2003 06:43:26 +0000 Subject: [PATCH] callback-interfaces-check-malloc-result-for-error-20030208 if we run out of memory, maybe we should assert. we should probably log. this is just so i remember to deal better. --- src/viced/callback.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/viced/callback.c b/src/viced/callback.c index 0973849d4..032a0cf2b 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1886,7 +1886,9 @@ int MultiBreakCallBackAlternateAddress_r(struct host *host, struct AFSCBFids *af i = host->interface->numberOfInterfaces; addr = malloc(i * sizeof(afs_int32)); + if (!addr) return 1; conns = malloc(i * sizeof(struct rx_connection *)); + if (!conns) { free(addr); return 1; } /* initialize alternate rx connections */ for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++) @@ -1970,7 +1972,9 @@ int MultiProbeAlternateAddress_r(struct host *host) i = host->interface->numberOfInterfaces; addr = malloc(i * sizeof(afs_int32)); + if (!addr) return 1; conns = malloc(i * sizeof(struct rx_connection *)); + if (!conns) { free(addr); return 1; } /* initialize alternate rx connections */ for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++) -- 2.39.5