From 24080a22b1cfa17ecf76a07d60205210b1b89952 Mon Sep 17 00:00:00 2001 From: Malcolm Robb Date: Sat, 22 Feb 2014 22:35:42 +0000 Subject: [PATCH] antirez Free the client on best effort write(2) short write --- net_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net_io.c b/net_io.c index 1ff16b1..2ff6c94 100644 --- a/net_io.c +++ b/net_io.c @@ -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; }