Hi,
It looks like httpd(8) is leaking memory in fcgi. The last line,
which is empty, does not get free'd. Thus save the return value,
then free the line and return.
While there I realized that the extra check for ':' is unnecessary.
strchr() will either return NULL or a ptr to ':'. As the check returns
if it sees a NULL the if will always find ':' in there.
Patrick
diff --git usr.sbin/httpd/server_fcgi.c usr.sbin/httpd/server_fcgi.c
index f3ba973..a726582 100644
--- usr.sbin/httpd/server_fcgi.c
+++ usr.sbin/httpd/server_fcgi.c
@@ -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;
@@ -769,12 +769,9 @@ server_fcgi_getheaders(struct client *clt)
if ((value = strchr(key, ':')) == NULL)
break;
- if (*value == ':') {
- *value++ = '\0';
- value += strspn(value, " \t");
- } else {
- *value++ = '\0';
- }
+
+ *value++ = '\0';
+ value += strspn(value, " \t");
DPRINTF("%s: %s: %s", __func__, key, value);
@@ -791,5 +788,8 @@ server_fcgi_getheaders(struct client *clt)
free(line);
}
- return (line != NULL && *line == '\0');
+ ret = (line != NULL && *line == '\0');
+
+ free(line);
+ return ret;
}