summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2016-10-07 07:33:54 +0000
committerpatrick <patrick@openbsd.org>2016-10-07 07:33:54 +0000
commit7f7ed8ccbae36d538e10bcaf64437e3fb3510755 (patch)
treeccae6e99a7bddeb2688a8ee427f95abafb86d4fe
parentDon't forget to add the CVS Id tag. (diff)
downloadwireguard-openbsd-7f7ed8ccbae36d538e10bcaf64437e3fb3510755.tar.xz
wireguard-openbsd-7f7ed8ccbae36d538e10bcaf64437e3fb3510755.zip
Empty lines cause server_fcgi_getheaders() to immediately return.
Unfortunately in that case the line was not freed. This lead to a memleak on each request. Thus, save the return value prior to returning, free the line and return the saved value. ok jung@
-rw-r--r--usr.sbin/httpd/server_fcgi.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c
index f3ba973b875..ad74aec705e 100644
--- a/usr.sbin/httpd/server_fcgi.c
+++ b/usr.sbin/httpd/server_fcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server_fcgi.c,v 1.71 2016/09/01 11:13:18 florian Exp $ */
+/* $OpenBSD: server_fcgi.c,v 1.72 2016/10/07 07:33:54 patrick Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
@@ -760,7 +760,7 @@ server_fcgi_getheaders(struct client *clt)
{
struct http_descriptor *resp = clt->clt_descresp;
struct evbuffer *evb = clt->clt_srvevb;
- int code;
+ int code, ret;
char *line, *key, *value;
const char *errstr;
@@ -791,5 +791,8 @@ server_fcgi_getheaders(struct client *clt)
free(line);
}
- return (line != NULL && *line == '\0');
+ ret = (line != NULL && *line == '\0');
+
+ free(line);
+ return ret;
}