Hi,

patch resolving #1030 attached.

Ilya
From eb849f02b0fef02a4d40f7566da3b54b2d0a8368 Mon Sep 17 00:00:00 2001
From: Ilya Shipitsin <chipits...@gmail.com>
Date: Thu, 7 Jan 2021 22:45:13 +0500
Subject: [PATCH] CLEANUP: replace "realloc" with "my_realloc2" to fix to
 memory leak

my_realloc2 frees variable in case of allocation failure

fixes #1030

realloc was introduced in 9e1758efbd68c8b1d27e17e2abe4444e110f3ebe

this might be backported to 2.2, 2.3
---
 src/cfgparse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cfgparse.c b/src/cfgparse.c
index c34b3a8f5..12eae67cc 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1983,7 +1983,7 @@ next_line:
 
 			if (err & (PARSE_ERR_TOOLARGE|PARSE_ERR_OVERLAP)) {
 				outlinesize = (outlen + 1023) & -1024;
-				outline = realloc(outline, outlinesize);
+				outline = my_realloc2(outline, outlinesize);
 				if (outline == NULL) {
 					ha_alert("parsing [%s:%d]: line too long, cannot allocate memory.\n",
 						 file, linenum);
-- 
2.29.2

Reply via email to