From 083b7ef675a37d1326eb92a58444574aff072788 Mon Sep 17 00:00:00 2001
From: bobcanthelpyou <bob@canthelpyou.com>
Date: Sun, 25 Nov 2018 13:28:13 +0100
Subject: [PATCH] gluon-mesh-babel: 'buf' nulled but not freed upon failure

---
 package/gluon-mesh-babel/src/respondd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/gluon-mesh-babel/src/respondd.c b/package/gluon-mesh-babel/src/respondd.c
index 075aa0649..dd47e3663 100644
--- a/package/gluon-mesh-babel/src/respondd.c
+++ b/package/gluon-mesh-babel/src/respondd.c
@@ -543,11 +543,12 @@ static int ask_l3roamd_for_client_count() {
 
 	int rc = 0;
 	do {
-		buf = realloc(buf, already_read + SOCKET_INPUT_BUFFER_SIZE + 1);
-		if (buf == NULL) {
+		char *buf_tmp = realloc(buf, already_read + SOCKET_INPUT_BUFFER_SIZE + 1);
+		if (buf_tmp == NULL) {
 			fprintf(stderr, "could not allocate memory for buffer\n");
 			goto end;
 		}
+		buf = buf_tmp;
 
 		rc = read(fd, &buf[already_read], SOCKET_INPUT_BUFFER_SIZE);
 		already_read+=rc;
-- 
GitLab