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

index 0973849d4579081e95c69810ea6cfa9db75fae43..032a0cf2bed90363b2ad436c3327cfd77b263794 100644 (file)
@@ -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++)