From cc358038dd1b2a3dd5d84d0c5cdaea016a997bb4 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Tue, 10 Jun 2014 02:56:30 +1000 Subject: [PATCH] Don't allocate extra memory in case it generates a false end of message marker --- src/ckpool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ckpool.c b/src/ckpool.c index 630eafa5..ce7c192a 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -173,7 +173,6 @@ int read_socket_line(connsock_t *cs, int timeout) goto out; } buflen = cs->bufofs + ret + 1; - align_len(&buflen); ptr = realloc(cs->buf, buflen); if (unlikely(!ptr)) quit(1, "Failed to alloc buf of %d bytes in read_socket_line", (int)buflen); @@ -194,7 +193,7 @@ int read_socket_line(connsock_t *cs, int timeout) out: if (ret < 0) { dealloc(cs->buf); - if (ret < 0 && cs->fd > 0) { + if (cs->fd > 0) { close(cs->fd); cs->fd = -1; }