From 936bc691b9648d1084f4fb1e4d7fa733992b8695 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sat, 8 Feb 2003 06:44:19 +0000 Subject: [PATCH] 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) --- src/viced/callback.c | 4 ++++ 1 file changed, 4 insertions(+) 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++) -- 2.39.5