cut and paste error - netaddr was free'ed twice. -Steve Reference: /n/sources/patch/applied/webfs-buglet Date: Tue Jan 29 17:02:55 CET 2008 Signed-off-by: steve@quintile.net --- /sys/src/cmd/webfs/http.c Tue Jan 29 17:00:53 2008 +++ /sys/src/cmd/webfs/http.c Tue Jan 29 17:00:48 2008 @@ -160,6 +160,7 @@ free(up); free(spec); snprint(hs->autherror, sizeof hs->autherror, "%r"); + fprint(2, "%s: Authentication failed: %r\n", argv0); } struct { @@ -282,8 +283,12 @@ Error: if(httpdebug) fprint(2, "iodial: %r\n"); + free(hs->location); + free(hs->setcookie); free(hs->netaddr); - close(hs->fd); + free(hs->credentials); + if(fd >= 0) + ioclose(io, hs->fd); hs->fd = -1; free(hs); c->aux = nil; @@ -474,7 +479,7 @@ werrstr("%s", hs->autherror); else werrstr("unauthorized; no www-authenticate: header"); - return -1; + goto Error; } c->authenticate = hs->credentials; hs->credentials = nil; @@ -482,7 +487,7 @@ if(redirect){ if(!hs->location){ werrstr("redirection without Location: header"); - return -1; + goto Error; } c->redirect = hs->location; hs->location = nil; @@ -513,7 +518,8 @@ hs = c->aux; if(hs == nil) return; - ioclose(c->io, hs->fd); + if(hs->fd >= 0) + ioclose(c->io, hs->fd); hs->fd = -1; free(hs->location); free(hs->setcookie); @@ -522,4 +528,3 @@ free(hs); c->aux = nil; } -