dangling pointer reference (Tim Wiess)

This commit is contained in:
Russ Cox 2006-10-12 03:21:03 +00:00
parent 353f9089e6
commit d4753beb37
1 changed files with 5 additions and 5 deletions

View File

@ -220,9 +220,6 @@ mntversion(Chan *c, char *version, int msize, int returnlen)
m->msize = f.msize; m->msize = f.msize;
unlock(&mntalloc.lk); unlock(&mntalloc.lk);
poperror(); /* msg */
free(msg);
lock(&m->lk); lock(&m->lk);
m->queue = 0; m->queue = 0;
m->rip = 0; m->rip = 0;
@ -232,16 +229,19 @@ mntversion(Chan *c, char *version, int msize, int returnlen)
m->c = c; m->c = c;
unlock(&m->lk); unlock(&m->lk);
poperror(); /* msg */
poperror(); /* c */ poperror(); /* c */
qunlock(&c->umqlock); qunlock(&c->umqlock);
k = strlen(f.version); k = strlen(f.version);
if(returnlen > 0){ if(returnlen > 0){
if(returnlen < k) if(returnlen < k){
free(msg);
error(Eshort); error(Eshort);
}
memmove(version, f.version, k); memmove(version, f.version, k);
} }
free(msg);
return k; return k;
} }