From 4c16e14e4187493f9d11429a0ecaaeeb747e2f89 Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 15 Dec 2013 21:28:29 +0100 Subject: [PATCH] Free the client on best effort write(2) short write. --- dump1090.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dump1090.c b/dump1090.c index 49d212c..25d039f 100644 --- a/dump1090.c +++ b/dump1090.c @@ -2264,8 +2264,8 @@ int handleHTTPRequest(struct client *c) { printf("HTTP Reply header:\n%s", hdr); /* 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;