From: Derrick Brashear Date: Sat, 8 Feb 2003 06:43:26 +0000 (+0000) Subject: callback-interfaces-check-malloc-result-for-error-20030208 X-Git-Tag: openafs-devel-1_3_50~391 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1e4b22a9f579cd53a4aa17caedf04d06fe965feb;p=packages%2Fo%2Fopenafs.git 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. --- 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++)