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 <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>
This commit is contained in:
Frank Lichtenheld 2026-05-07 09:53:15 +02:00 committed by Gert Doering
parent 74d39dfba2
commit fcc34b1352
2 changed files with 3 additions and 0 deletions

View 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

View 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;