From 2dcdfb0d331dfd4633dd45dbdc382567de1e977e Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 16 Nov 2011 22:15:31 +0100 Subject: webfs: more leaks --- sys/src/cmd/webfs/client.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/src/cmd/webfs/client.c b/sys/src/cmd/webfs/client.c index 26ce28350..bd80da4a7 100644 --- a/sys/src/cmd/webfs/client.c +++ b/sys/src/cmd/webfs/client.c @@ -94,10 +94,10 @@ clientbodyopen(Client *c, Req *r) fprint(2, "try %s\n", c->url->url); if(c->url->open(c, c->url) < 0){ Error: + rerrstr(e, sizeof e); if(next) fprint(2, "next %s (but for error)\n", next); free(next); - rerrstr(e, sizeof e); c->iobusy = 0; if(r != nil) r->fid->omode = -1; @@ -106,12 +106,18 @@ clientbodyopen(Client *c, Req *r) respond(r, e); return; } - if (c->authenticate && nauth++ < 1) - continue; - if(!c->redirect) - break; + free(next); next = c->redirect; c->redirect = nil; + if(c->authenticate && nauth++ < 1){ + if(c->url->close) + (*c->url->close)(c); + free(next); + next = nil; + continue; + } + if(next == nil) + break; if(i==c->ctl.redirectlimit){ werrstr("redirect limit reached"); goto Error; -- cgit v1.2.3