NewTrans(afs_int32 avol, afs_int32 apart)
{
/* set volid, next, partition */
- register struct volser_trans *tt;
+ struct volser_trans *tt, *newtt;
struct timeval tp;
struct timezone tzp;
+ newtt = (struct volser_trans *)malloc(sizeof(struct volser_trans));
VTRANS_LOCK;
/* don't allow the same volume to be attached twice */
for (tt = allTrans; tt; tt = tt->next) {
if ((tt->volid == avol) && (tt->partition == apart)) {
VTRANS_UNLOCK;
+ free(newtt);
return (struct volser_trans *)0; /* volume busy */
}
}
- VTRANS_UNLOCK;
- tt = (struct volser_trans *)malloc(sizeof(struct volser_trans));
+ newtt = tt;
memset(tt, 0, sizeof(struct volser_trans));
tt->volid = avol;
tt->partition = apart;
gettimeofday(&tp, &tzp);
tt->creationTime = tp.tv_sec;
tt->time = FT_ApproxTime();
- VTRANS_LOCK;
tt->tid = transCounter++;
tt->next = allTrans;
allTrans = tt;