]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: cfgparse: replace "realloc" with "my_realloc2" to fix to memory leak on...
authorIlya Shipitsin <chipitsine@gmail.com>
Thu, 7 Jan 2021 17:45:13 +0000 (22:45 +0500)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Jan 2021 13:45:39 +0000 (14:45 +0100)
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

index c34b3a8f54eeb246f640d55eecc77e2a25677bca..12eae67cc46bf569003e099d6f7a8e0a6b44bf26 100644 (file)
@@ -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);