From: jsg Date: Thu, 8 Oct 2015 09:40:32 +0000 (+0000) Subject: fix an fd leak if socket connection fails; from Carlin Bingham X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=702d5e8d57cb5b750653ca09a1cfce9fecef25cc;p=openbsd fix an fd leak if socket connection fails; from Carlin Bingham ok reyk@ --- diff --git a/usr.sbin/httpd/server_fcgi.c b/usr.sbin/httpd/server_fcgi.c index 9d4d84a765a..0211a0dbec3 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.65 2015/10/08 09:32:13 jsg Exp $ */ +/* $OpenBSD: server_fcgi.c,v 1.66 2015/10/08 09:40:32 jsg Exp $ */ /* * Copyright (c) 2014 Florian Obser @@ -399,6 +399,8 @@ server_fcgi(struct httpd *env, struct client *clt) free(script); if (errstr == NULL) errstr = strerror(errno); + if (fd != -1 && clt->clt_fd != fd) + close(fd); server_abort_http(clt, 500, errstr); return (-1); }