}
/* No server entry added. Add one */
if (!(*ss)) {
- *ss = (struct serversort *)malloc(sizeof(struct serversort));
+ *ss = calloc(1, sizeof(struct serversort));
if (!(*ss)) {
afs_com_err(whoami, BC_NOMEM, NULL);
*ss = 0;
return (BC_NOMEM);
}
- memset(*ss, 0, sizeof(struct serversort));
(*ss)->ipaddr = server;
(*ss)->next = *serverlist;
*serverlist = *ss;
}
/* No partition entry added. Add one */
if (!(*ps)) {
- *ps = (struct partitionsort *)malloc(sizeof(struct partitionsort));
+ *ps = calloc(1, sizeof(struct partitionsort));
if (!(*ps)) {
afs_com_err(whoami, BC_NOMEM, NULL);
free(*ss);
*ss = 0;
return (BC_NOMEM);
}
- memset(*ps, 0, sizeof(struct partitionsort));
(*ps)->part = partition;
(*ps)->next = (*ss)->partitions;
(*ss)->partitions = *ps;
if (add) {
/* Allocate a volume dump structure and its name */
- tvd = (struct bc_volumeDump *)
- malloc(sizeof(struct bc_volumeDump));
+ tvd = calloc(1, sizeof(struct bc_volumeDump));
if (!tvd) {
afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
- memset(tvd, 0, sizeof(*tvd));
tvd->name = (char *)malloc(strlen(entries[e].name) + 10);
if (!(tvd->name)) {
}
total++;
- tvd = (struct bc_volumeDump *)
- malloc(sizeof(struct bc_volumeDump));
+ tvd = calloc(1, sizeof(struct bc_volumeDump));
if (!tvd) {
afs_com_err(whoami, BC_NOMEM, NULL);
return (BC_NOMEM);
}
- memset(tvd, 0, sizeof(*tvd));
tvd->name = (char *)malloc(strlen(entry.name) + 10);
if (!(tvd->name)) {
for (ti = as->parms[2].items; ti; ti = ti->next) {
/* build list of volume items */
- tvol = (struct bc_volumeDump *)malloc(sizeof(struct bc_volumeDump));
+ tvol = calloc(1, sizeof(struct bc_volumeDump));
if (!tvol) {
afs_com_err(whoami, BC_NOMEM, NULL);
return BC_NOMEM;
}
- memset(tvol, 0, sizeof(struct bc_volumeDump));
tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
if (!tvol->name) {
}
/* Allocate a volumeDump structure and link it in */
- tvol =
- (struct bc_volumeDump *)malloc(sizeof(struct bc_volumeDump));
- memset(tvol, 0, sizeof(struct bc_volumeDump));
+ tvol = calloc(1, sizeof(struct bc_volumeDump));
tvol->name = (char *)malloc(VOLSER_MAXVOLNAME + 1);
if (!tvol->name) {
for (i = 0; i < numEntries; i++) { /*f */
struct dumpedVol *insPtr, **prevPtr;
- tempPtr =
- (struct dumpedVol *)malloc(sizeof(struct dumpedVol));
+ tempPtr = calloc(1, sizeof(struct dumpedVol));
if (!tempPtr)
ERROR(BC_NOMEM);
- memset(tempPtr, 0, sizeof(*tempPtr));
tempPtr->incTime = volumeEntry[i].clone;
tempPtr->dumpID = volumeEntry[i].dump;
strncpy(tempPtr->tapeName, volumeEntry[i].tape,
/* now get the list of tapes */
for (tapeNumber = dumpEntry.tapes.b; tapeNumber <= dumpEntry.tapes.maxTapes; tapeNumber++) { /*f */
- tapeLinkPtr = (struct tapeLink *)malloc(sizeof(struct tapeLink));
+ tapeLinkPtr = calloc(1, sizeof(struct tapeLink));
if (!tapeLinkPtr) {
afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
- memset(tapeLinkPtr, 0, sizeof(*tapeLinkPtr));
code = bcdb_FindTapeSeq(dumpid, tapeNumber, &tapeLinkPtr->tapeEntry);
if (code) {
code = 0;
for (i = 0; i < vl.budb_volumeList_len; i++) {
link = &tapeLinkPtr->firstVolume;
- volumeLinkPtr =
- (struct volumeLink *)malloc(sizeof(struct volumeLink));
+ volumeLinkPtr = calloc(1, sizeof(struct volumeLink));
if (!volumeLinkPtr) {
afs_com_err(whoami, BC_NOMEM, NULL);
ERROR(BC_NOMEM);
}
- memset(volumeLinkPtr, 0, sizeof(*volumeLinkPtr));
memcpy(&volumeLinkPtr->volumeEntry,
&vl.budb_volumeList_val[i],