From: Derrick Brashear Date: Sat, 8 Feb 2003 06:44:19 +0000 (+0000) Subject: STABLE12-callback-interfaces-check-malloc-result-for-error-20030208 X-Git-Tag: openafs-stable-1_2_9~55 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=936bc691b9648d1084f4fb1e4d7fa733992b8695;p=packages%2Fo%2Fopenafs.git STABLE12-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. (cherry picked from commit 1e4b22a9f579cd53a4aa17caedf04d06fe965feb) --- diff --git a/src/viced/callback.c b/src/viced/callback.c index d25c7adfc..76c44bbb5 100644 --- a/src/viced/callback.c +++ b/src/viced/callback.c @@ -1812,7 +1812,9 @@ struct AFSCBFids* afidp; 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++) @@ -1897,7 +1899,9 @@ 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++)