]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
dco_freebsd: Add check_malloc_return after realloc
authorFrank Lichtenheld <frank@lichtenheld.com>
Thu, 7 May 2026 07:53:15 +0000 (09:53 +0200)
committerGert Doering <gert@greenie.muc.de>
Thu, 7 May 2026 08:56:35 +0000 (10:56 +0200)
cppcheck complained about a potential memleak
due to realloc failure. But trying to handle that
is probably not useful. Just abort like we do
for other malloc failures.

Change-Id: Icd8ea093dfe9f1888570f3d7b786b951b5262e47
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1669
Message-Id: <20260507075321.25123-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg36842.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
dev-tools/cppcheck-suppression
src/openvpn/dco_freebsd.c

index 1f31edb973c0394fa4fba3f0b5c4e35e37f7d145..439cbb1a65dd79c3f13b6c0164567ef63489e7da 100644 (file)
@@ -44,6 +44,8 @@ knownConditionTrueFalse:src/tapctl/main.c:704
 knownConditionTrueFalse:src/openvpnmsica/dllmain.c:164
 # FP: cppcheck seems to be confused since we cast the pointer to integer
 memleak:src/plugins/down-root/down-root.c:337
+# IGN: we just abort instead
+memleakOnRealloc:src/openvpn/dco_freebsd.c:845
 # FP: eventmsg.h is not built on Unix
 missingInclude:src/openvpnserv/common.c:25
 # IGN: strlen(NULL) is not nice code, but seems to work
index 718cd8b2e8afaa857c742f97926e862ad5b31473..eaca86b9fda27ce29f179ca3917d5ed96651edce 100644 (file)
@@ -842,6 +842,7 @@ dco_get_peer_stats_multi(dco_context_t *dco, const bool raise_sigusr1_on_err)
 
 retry:
     buf = realloc(buf, buf_size);
+    check_malloc_return(buf);
     drv.ifd_len = buf_size;
     drv.ifd_data = buf;