Free the client on best effort write(2) short write
This commit is contained in:
Malcolm Robb 2014-02-22 22:35:42 +00:00
parent b9a1a3e650
commit 24080a22b1

View file

@ -737,7 +737,8 @@ int handleHTTPRequest(struct client *c, char *p) {
}
// Send header and content.
if (write(c->fd, hdr, hdrlen) == -1 || write(c->fd, content, clen) == -1) {
if ( (write(c->fd, hdr, hdrlen) != hdrlen)
|| (write(c->fd, content, clen) != clen) ) {
free(content);
return 1;
}