From: Frank Lichtenheld Date: Thu, 7 May 2026 07:53:15 +0000 (+0200) Subject: dco_freebsd: Add check_malloc_return after realloc X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fcc34b135222edf3d53976f406f8db19c19294c0;p=thirdparty%2Fopenvpn.git dco_freebsd: Add check_malloc_return after realloc 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 Acked-by: Gert Doering 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 --- diff --git a/dev-tools/cppcheck-suppression b/dev-tools/cppcheck-suppression index 1f31edb97..439cbb1a6 100644 --- a/dev-tools/cppcheck-suppression +++ b/dev-tools/cppcheck-suppression @@ -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 diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index 718cd8b2e..eaca86b9f 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -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;