paqfs: fix potential freeing of non heap string

This commit is contained in:
cinap_lenrek 2011-08-23 00:23:00 +02:00
parent ae103e2aa4
commit 5548300537

View file

@ -72,7 +72,6 @@ int qflag;
Fid * newfid(int);
void paqstat(PaqDir*, char*);
void io(int fd);
void *erealloc(void*, ulong);
void *emalloc(ulong);
void *emallocz(ulong n);
char *estrdup(char*);
@ -300,7 +299,7 @@ rattach(Fid *f)
if(rhdr.uname[0])
f->user = estrdup(rhdr.uname);
else
f->user = "none";
f->user = estrdup("none");
return 0;
}
@ -317,7 +316,7 @@ clone(Fid *f, Fid **res)
nf->busy = 1;
nf->open = 0;
nf->paq = paqCpy(f->paq);
nf->user = strdup(f->user);
nf->user = estrdup(f->user);
*res = nf;
return 0;
}
@ -570,7 +569,9 @@ rclunk(Fid *f)
f->busy = 0;
f->open = 0;
free(f->user);
f->user = 0;
paqFree(f->paq);
f->paq = 0;
return 0;
}
@ -1078,15 +1079,6 @@ emallocz(ulong n)
return p;
}
void *
erealloc(void *p, ulong n)
{
p = realloc(p, n);
if(!p)
sysfatal("out of memory");
return p;
}
char *
estrdup(char *s)
{