Browse Source

Don't allocate extra memory in case it generates a false end of message marker

master
Con Kolivas 11 years ago
parent
commit
cc358038dd
  1. 3
      src/ckpool.c

3
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;
}

Loading…
Cancel
Save