]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-callback-interfaces-check-malloc-result-for-error-20030208
authorDerrick Brashear <shadow@dementia.org>
Sat, 8 Feb 2003 06:44:19 +0000 (06:44 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 8 Feb 2003 06:44:19 +0000 (06:44 +0000)
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)

src/viced/callback.c

index d25c7adfc1099c43887bf17fafcf4e98d121ea8d..76c44bbb5fc43062db439988d325a1554ad5c794 100644 (file)
@@ -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++)