gluon-mesh-babel: 'buf' nulled but not freed upon failure

This commit is contained in:
bobcanthelpyou 2018-11-25 13:28:13 +01:00 committed by Christof Schulze
parent bcf4d076e1
commit 083b7ef675

View File

@ -543,11 +543,12 @@ static int ask_l3roamd_for_client_count() {
int rc = 0; int rc = 0;
do { do {
buf = realloc(buf, already_read + SOCKET_INPUT_BUFFER_SIZE + 1); char *buf_tmp = realloc(buf, already_read + SOCKET_INPUT_BUFFER_SIZE + 1);
if (buf == NULL) { if (buf_tmp == NULL) {
fprintf(stderr, "could not allocate memory for buffer\n"); fprintf(stderr, "could not allocate memory for buffer\n");
goto end; goto end;
} }
buf = buf_tmp;
rc = read(fd, &buf[already_read], SOCKET_INPUT_BUFFER_SIZE); rc = read(fd, &buf[already_read], SOCKET_INPUT_BUFFER_SIZE);
already_read+=rc; already_read+=rc;