diff options
author | cinap_lenrek <cinap_lenrek@localhost> | 2011-08-23 00:23:00 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-08-23 00:23:00 +0200 |
commit | 554830053712718c007a05aea3385e3a2efb957c (patch) | |
tree | f3c92169c3cc2d341d7dd4a916b0d21bb0690de8 /sys/src/cmd/paqfs | |
parent | ae103e2aa47927b6a7213836b6c60332bef8e2f8 (diff) |
paqfs: fix potential freeing of non heap string
Diffstat (limited to 'sys/src/cmd/paqfs')
-rw-r--r-- | sys/src/cmd/paqfs/paqfs.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/src/cmd/paqfs/paqfs.c b/sys/src/cmd/paqfs/paqfs.c index bf640cc7b..b2713682b 100644 --- a/sys/src/cmd/paqfs/paqfs.c +++ b/sys/src/cmd/paqfs/paqfs.c @@ -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) { |