From e763cfbf76e733028ca4f996d94bb96317732ad9 Mon Sep 17 00:00:00 2001 From: RainRat Date: Fri, 17 Nov 2023 18:00:00 -0800 Subject: [PATCH] Update allow_list.c potential memory leak https://github.com/Cisco-Talos/clamav/issues/1092 --- clamav-milter/allow_list.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clamav-milter/allow_list.c b/clamav-milter/allow_list.c index 09f37ff560..fed7ff512a 100644 --- a/clamav-milter/allow_list.c +++ b/clamav-milter/allow_list.c @@ -157,12 +157,14 @@ int smtpauth_init(const char *r) if (len <= 0) continue; if (len * 3 + 1 > rxavail) { ptr = regex; - regex = realloc(regex, rxsize + 2048); - if (!regex) { + char *temp = realloc(regex, rxsize + 2048); + if (!temp) { + free(regex); logg(LOGG_ERROR, "Cannot allocate memory for SkipAuthenticated file\n"); fclose(f); return 1; } + regex = temp; rxavail = 2048; rxsize += 2048; if (!ptr) {