diff options
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1316,7 +1316,6 @@ static int update_lstate(struct http_ctx *const h, bool *const close, int (*const f)(struct http_ctx *), const char *const buf, size_t *const sz) { - int ret = 1; struct ctx *const c = &h->ctx; const char b = *buf; @@ -1330,7 +1329,7 @@ static int update_lstate(struct http_ctx *const h, bool *const close, else { fprintf(stderr, "%s: line too long\n", __func__); - goto failure; + return 1; } break; @@ -1340,8 +1339,10 @@ static int update_lstate(struct http_ctx *const h, bool *const close, { h->line[c->len] = '\0'; - if ((ret = f(h))) - goto failure; + const int ret = f(h); + + if (ret) + return ret; c->len = 0; } @@ -1353,7 +1354,7 @@ static int update_lstate(struct http_ctx *const h, bool *const close, else { fprintf(stderr, "%s: line too long\n", __func__); - goto failure; + return 1; } c->lstate = LINE_CR; @@ -1362,10 +1363,6 @@ static int update_lstate(struct http_ctx *const h, bool *const close, (*sz)--; return 0; - -failure: - ctx_free(c); - return ret; } static int start_boundary_line(struct http_ctx *const h) @@ -2188,7 +2185,10 @@ int http_read(struct http_ctx *const h, bool *const close) const int ret = read_buf(h, close, &buf[r - rem], &rem); if (ret) + { + ctx_free(&h->ctx); return ret; + } } return 0; |
