afs_fsize_t length;
vnode = (struct VnodeDiskObject *)malloc(SIZEOF_LARGEDISKVNODE);
+ if (!vnode)
+ return ENOMEM;
memset(vnode, 0, SIZEOF_LARGEDISKVNODE);
V_pref(vp, nearInode);
struct Volume *vp;
int i, is_incremental;
- if (results)
+ if (results) {
memset(results, 0, sizeof(manyResults));
+ i = results->manyResults_len = destinations->manyDests_len;
+ results->manyResults_val = codes =
+ (afs_int32 *) malloc(i * sizeof(afs_int32));
+ }
+ if (!results || !results->manyResults_val)
+ return ENOMEM;
if (!afsconf_SuperUser(tdir, acid, caller))
return VOLSERBAD_ACCESS; /*not a super user */
/* (fromDate == 0) ==> full dump */
is_incremental = (fromDate ? 1 : 0);
- i = results->manyResults_len = destinations->manyDests_len;
- results->manyResults_val = codes =
- (afs_int32 *) malloc(i * sizeof(afs_int32));
tcons =
(struct rx_connection **)malloc(i * sizeof(struct rx_connection *));
+ if (!tcons) {
+ return ENOMEM;
+ }
tcalls = (struct rx_call **)malloc(i * sizeof(struct rx_call *));
+ if (!tcalls) {
+ free(tcons);
+ return ENOMEM;
+ }
/* get auth info for this connection (uses afs from ticket file) */
code = afsconf_ClientAuth(tdir, &securityObject, &securityIndex);
struct volser_trans *tt;
register int len;
- *aname = NULL;
+ /* We need to at least fill it in */
+ *aname = (char *)malloc(1);
+ if (!*aname)
+ return ENOMEM;
tt = FindTrans(atrans);
if (!tt)
return ENOENT;
TRELE(tt);
return E2BIG;
}
- *aname = (char *)malloc(len);
+ *aname = (char *)realloc(*aname, len);
strcpy(*aname, td->name);
tt->rxCallPtr = (struct rx_call *)0;
if (TRELE(tt))
partList.partId[j++] = i;
}
pEntries->partEntries_val = (afs_int32 *) malloc(j * sizeof(int));
+ if (!pEntries->partEntries_val)
+ return ENOMEM;
memcpy((char *)pEntries->partEntries_val, (char *)&partList,
j * sizeof(int));
pEntries->partEntries_len = j;
volint_info_handle_t handle;
volumeInfo->volEntries_val = (volintInfo *) malloc(sizeof(volintInfo));
+ if (!volumeInfo->volEntries_val)
+ return ENOMEM;
pntr = volumeInfo->volEntries_val;
volumeInfo->volEntries_len = 1;
if (GetPartName(partid, pname))
*/
a_volumeXInfoP->volXEntries_val =
(volintXInfo *) malloc(sizeof(volintXInfo));
+ if (!a_volumeXInfoP->volXEntries_val)
+ return ENOMEM;
xInfoP = a_volumeXInfoP->volXEntries_val;
a_volumeXInfoP->volXEntries_len = 1;
code = ENODEV;
volumeInfo->volEntries_val =
(volintInfo *) malloc(allocSize * sizeof(volintInfo));
+ if (!volumeInfo->volEntries_val)
+ return ENOMEM;
pntr = volumeInfo->volEntries_val;
volumeInfo->volEntries_len = 0;
if (GetPartName(partid, pname))
*/
a_volumeXInfoP->volXEntries_val =
(volintXInfo *) malloc(allocSize * sizeof(volintXInfo));
+ if (!a_volumeXInfoP->volXEntries_val)
+ return ENOMEM;
xInfoP = a_volumeXInfoP->volXEntries_val;
a_volumeXInfoP->volXEntries_len = 0;
transInfo->transDebugEntries_val =
(transDebugInfo *) malloc(allocSize * sizeof(transDebugInfo));
+ if (!transInfo->transDebugEntries_val)
+ return ENOMEM;
pntr = transInfo->transDebugEntries_val;
transInfo->transDebugEntries_len = 0;
allTrans = TransList();