/* now allocate and copy these things; they're freed by the RXGEN stub */
temp = strlen(V_name(volptr)) + 1;
*name = malloc(temp);
+ if (!*name) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*name, V_name(volptr));
temp = strlen(V_offlineMessage(volptr)) + 1;
*offMsg = malloc(temp);
+ if (!*offMsg) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*offMsg, V_offlineMessage(volptr));
#if TRANSARC_VOL_STATS
*motd = malloc(1);
+ if (!*motd) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*motd, nullString);
#else
temp = strlen(V_motd(volptr)) + 1;
*motd = malloc(temp);
+ if (!*motd) {
+ ViceLog(0, ("Failed malloc in RXGetVolumeStatus\n"));
+ assert(0);
+ }
strcpy(*motd, V_motd(volptr));
#endif /* FS_STATS_DETAILED */
FS_LOCK
afs_buffersAlloced++;
if (!freeBufferList) {
+ char *tmp;
FS_UNLOCK
- return malloc(sendBufSize);
+
+ tmp = malloc(sendBufSize);
+ if (!tmp) {
+ ViceLog(0, ("Failed malloc in AllocSendBuffer\n"));
+ assert(0);
+ }
+ return tmp;
}
tp = freeBufferList;
freeBufferList = tp->next;
AccessList->AFSOpaque_len = 0;
AccessList->AFSOpaque_val = malloc(AFSOPAQUEMAX);
+ if (!AccessList->AFSOpaque_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_FetchACL\n"));
+ assert(0);
+ }
/*
* Get volume/vnode for the fetched file; caller's access rights to it
/* allocate space for return output parameters */
OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
malloc(nfiles * sizeof(struct AFSFetchStatus));
+ if (!OutStats->AFSBulkStats_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
+ assert(0);
+ }
OutStats->AFSBulkStats_len = nfiles;
CallBacks->AFSCBs_val = (struct AFSCallBack *)
malloc(nfiles * sizeof(struct AFSCallBack));
+ if (!CallBacks->AFSCBs_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_BulkStatus\n"));
+ assert(0);
+ }
CallBacks->AFSCBs_len = nfiles;
if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
/* allocate space for return output parameters */
OutStats->AFSBulkStats_val = (struct AFSFetchStatus *)
malloc(nfiles * sizeof(struct AFSFetchStatus));
+ if (!OutStats->AFSBulkStats_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
+ assert(0);
+ }
OutStats->AFSBulkStats_len = nfiles;
CallBacks->AFSCBs_val = (struct AFSCallBack *)
malloc(nfiles * sizeof(struct AFSCallBack));
+ if (!CallBacks->AFSCBs_val) {
+ ViceLog(0, ("Failed malloc in SRXAFS_FetchStatus\n"));
+ assert(0);
+ }
CallBacks->AFSCBs_len = nfiles;
if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon))) {
/* N.B. The "-1", below, is because
FE[0] and CB[0] are not used--and not allocated */
FE = ((struct FileEntry *)(malloc(sizeof(struct FileEntry)*nblks)))-1;
+ if (!FE) {
+ ViceLog(0, ("Failed malloc in InitCallBack\n"));
+ assert(0);
+ }
cbstuff.nFEs = nblks;
while (cbstuff.nFEs)
FreeFE(&FE[cbstuff.nFEs]); /* This is correct */
CB = ((struct CallBack *)(malloc(sizeof(struct CallBack)*nblks)))-1;
+ if (!CB) {
+ ViceLog(0, ("Failed malloc in InitCallBack\n"));
+ assert(0);
+ }
cbstuff.nCBs = nblks;
while (cbstuff.nCBs)
FreeCB(&CB[cbstuff.nCBs]); /* This is correct */
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; }
+ if (!addr || !conns) {
+ ViceLog(0, ("Failed malloc in MultiBreakCallBackAlternateAddress_r\n"));
+ assert(0);
+ }
/* initialize alternate rx connections */
for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++)
sc = rxnull_NewClientSecurityObject();
i = host->interface->numberOfInterfaces;
- addr = malloc(i * sizeof(afs_int32));
- if (!addr) return 1;
+ addr = malloc(i * sizeof(afs_int32));
conns = malloc(i * sizeof(struct rx_connection *));
- if (!conns) { free(addr); return 1; }
+ if (!addr || !conns) {
+ ViceLog(0, ("Failed malloc in MultiProbeAlternateAddress_r\n"));
+ assert(0);
+ }
/* initialize alternate rx connections */
for ( i=0,j=0; i < host->interface->numberOfInterfaces; i++)
host = GetHT();
h_hashChain = (struct h_hashChain*) malloc(sizeof(struct h_hashChain));
- assert(h_hashChain);
+ if (!h_hashChain) {
+ ViceLog(0, ("Failed malloc in h_Alloc_r\n"));
+ assert(0);
+ }
h_hashChain->hostPtr = host;
h_hashChain->addr = rxr_HostOf(r_con);
h_hashChain->next = hostHashTable[index];
return;
}
list = (struct host **)malloc(hostCount * sizeof(struct host *));
- assert(list != NULL);
+ if (!list) {
+ ViceLog(0, ("Failed malloc in h_Enumerate\n"));
+ assert(0);
+ }
held = (int *)malloc(hostCount * sizeof(int));
- assert(held != NULL);
+ if (!held) {
+ ViceLog(0, ("Failed malloc in h_Enumerate\n"));
+ assert(0);
+ }
for (count = 0, host = hostList ; host ; host = host->next, count++) {
list[count] = host;
if (!(held[count] = h_Held_r(host)))
/* insert into beginning of list for this bucket */
chain = (struct h_hashChain *)malloc(sizeof(struct h_hashChain));
+ if (!chain) {
+ ViceLog(0, ("Failed malloc in hashInsertUuid_r\n"));
+ assert(0);
+ }
assert(chain);
chain->hostPtr = host;
chain->next = hostUuidHashTable[index];
H_LOCK
if ( code == RXGEN_OPCODE ) {
identP = (struct Identity *)malloc(sizeof(struct Identity));
+ if (!identP) {
+ ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
+ assert(0);
+ }
identP->valid = 0;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
/* The host on this connection was unable to respond to
} else if (code == 0) {
interfValid = 1;
identP = (struct Identity *)malloc(sizeof(struct Identity));
+ if (!identP) {
+ ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
+ assert(0);
+ }
identP->valid = 1;
identP->uuid = interf.uuid;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
code = RXAFSCB_WhoAreYou(host->callback_rxcon, &interf);
H_LOCK
if ( code == RXGEN_OPCODE ) {
- identP = (struct Identity *)malloc(sizeof(struct Identity));
+ identP = (struct Identity *)malloc(sizeof(struct Identity));
+ if (!identP) {
+ ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
+ assert(0);
+ }
identP->valid = 0;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
ViceLog(25,
} else if (code == 0) {
interfValid = 1;
identP = (struct Identity *)malloc(sizeof(struct Identity));
+ if (!identP) {
+ ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
+ assert(0);
+ }
identP->valid = 1;
identP->uuid = interf.uuid;
rx_SetSpecific(tcon, rxcon_ident_key, identP);
}
foreign = 1; /* attempt cross-cell authentication */
tname = (char *) malloc(anamelen+cnamelen+2);
+ if (!tname) {
+ ViceLog(0, ("Failed malloc in MapName_r\n"));
+ assert(0);
+ }
strcpy(tname, aname);
tname[anamelen] = '@';
strcpy(tname+anamelen+1, acell);
lids.idlist_len = 1;
lids.idlist_val = (afs_int32 *)malloc(1*sizeof(afs_int32));
+ if (!lids.idlist_val) {
+ ViceLog(0, ("Failed malloc in h_UserName\n"));
+ assert(0);
+ }
lnames.namelist_len = 0;
lnames.namelist_val = (prname *)0;
lids.idlist_val[0] = client->ViceId;
interface = (struct Interface *)
malloc(sizeof(struct Interface) +
(sizeof(afs_int32) * (count-1)));
- assert(interface);
+ if (!interface) {
+ ViceLog(0, ("Failed malloc in initInterfaceAddr_r\n"));
+ assert(0);
+ }
interface->numberOfInterfaces = count;
} else {
interface = (struct Interface *)
/* insert into beginning of list for this bucket */
chain = (struct h_hashChain *)malloc(sizeof(struct h_hashChain));
- assert(chain);
+ if (!chain) {
+ ViceLog(0, ("Failed malloc in hashInsert_r\n"));
+ assert(0);
+ }
chain->hostPtr = host;
chain->next = hostHashTable[index];
chain->addr = addr;
interface = (struct Interface *)
malloc(sizeof(struct Interface) +
(sizeof(afs_int32) * number));
+ if (!interface) {
+ ViceLog(0, ("Failed malloc in addInterfaceAddr_r\n"));
+ assert(0);
+ }
interface->numberOfInterfaces = number + 1;
interface->uuid = host->interface->uuid;
for (i = 0 ; i < number ; i++)