diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-01-30 09:54:42 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2017-01-30 09:54:42 +0000 |
commit | 3fe9e025cb9425a1894d7f2352dd390cd003e985 (patch) | |
tree | 4460b2351ee35714788fb62a21ccd47f84d3ceb7 /usr.sbin/httpd/server_file.c | |
parent | bb43575771150e474f4ed723329520706d8c8cd7 (diff) |
Fix error path of range requests, found while reviewing byte range support.
OK jsg@
Diffstat (limited to 'usr.sbin/httpd/server_file.c')
-rw-r--r-- | usr.sbin/httpd/server_file.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c index 48ecbb591d3..500742ec927 100644 --- a/usr.sbin/httpd/server_file.c +++ b/usr.sbin/httpd/server_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_file.c,v 1.62 2016/05/17 03:12:39 deraadt Exp $ */ +/* $OpenBSD: server_file.c,v 1.63 2017/01/30 09:54:41 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -399,8 +399,6 @@ server_partial_file_request(struct httpd *env, struct client *clt, char *path, goto fail; case 0: /* Connection is already finished */ - evbuffer_free(evb); - evb = NULL; goto done; default: break; @@ -409,9 +407,6 @@ server_partial_file_request(struct httpd *env, struct client *clt, char *path, if (server_bufferevent_write_buffer(clt, evb) == -1) goto fail; - evbuffer_free(evb); - evb = NULL; - bufferevent_enable(clt->clt_bev, EV_READ|EV_WRITE); if (clt->clt_persist) clt->clt_toread = TOREAD_HTTP_HEADER; @@ -420,6 +415,7 @@ server_partial_file_request(struct httpd *env, struct client *clt, char *path, clt->clt_done = 0; done: + evbuffer_free(evb); server_reset_http(clt); return (0); fail: @@ -427,6 +423,8 @@ server_partial_file_request(struct httpd *env, struct client *clt, char *path, bufferevent_free(clt->clt_bev); clt->clt_bev = NULL; abort: + if (evb != NULL) + evbuffer_free(evb); if (fd != -1) close(fd); if (errstr == NULL) |