From: "flichtenheld (Code Review)"
Date: Wed, 6 May 2026 21:21:27 +0000
References:
Reply-To: frank@...2641..., arne-openvpn@...1227...,
openvpn-devel@lists.sourceforge.net
Message-ID:
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Disposition: inline
Content-Type: multipart/alternative; boundary="7ua+J8t9Ubk="; charset=UTF-8
Subject: [Openvpn-devel] [XS] Change in openvpn[master]: dco_freebsd: Add
check_malloc_return after realloc
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
To: plaisthos
Cc: openvpn-devel
--7ua+J8t9Ubk=
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1669?usp=3Demail
to review the following change.
Change subject: dco_freebsd: Add check_malloc_return after realloc
......................................................................
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
---
M dev-tools/cppcheck-suppression
M src/openvpn/dco_freebsd.c
2 files changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/1669/1
diff --git a/dev-tools/cppcheck-suppression b/dev-tools/cppcheck-suppression
index 1fefb51..c9d4714 100644
--- a/dev-tools/cppcheck-suppression
+++ b/dev-tools/cppcheck-suppression
@@ -49,6 +49,8 @@
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 718cd8b..eaca86b 100644
--- a/src/openvpn/dco_freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@@ -842,6 +842,7 @@
retry:
buf =3D realloc(buf, buf_size);
+ check_malloc_return(buf);
drv.ifd_len =3D buf_size;
drv.ifd_data =3D buf;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1669?usp=3Demail
To unsubscribe, or for help writing mail filters, visit http://gerrit.openv=
pn.net/settings?usp=3Demail
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icd8ea093dfe9f1888570f3d7b786b951b5262e47
Gerrit-Change-Number: 1669
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld
Gerrit-Reviewer: plaisthos
Gerrit-CC: openvpn-devel
Gerrit-Attention: plaisthos
--7ua+J8t9Ubk=
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Attention is cur=
rently required from: plaisthos.
flichtenheld would like plaisthos to review this change.
V=
iew Change
dco_freebsd: Add check_malloc_return after =
realloc
cppcheck complained about a potential memleak
due to real=
loc failure. But trying to handle that
is probably not useful. Just abor=
t like we do
for other malloc failures.
Change-Id: Icd8ea093dfe9f=
1888570f3d7b786b951b5262e47
Signed-off-by: Frank Lichtenheld <frank@...220...=
..2641...>
---
M dev-tools/cppcheck-suppression
M src/openvpn/d=
co_freebsd.c
2 files changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chang=
es/69/1669/1
diff --git a/dev-tools/cppcheck-suppression b/dev-tool=
s/cppcheck-suppression
index 1fefb51..c9d4714 100644=
--- a/dev-tools/cppcheck-suppression
+++ b/dev-to=
ols/cppcheck-suppression
@@ -49,6 +49,8 @@
=
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<=
br>+memleakOnRealloc:src/openvp=
n/dco_freebsd.c:845
# FP: eventmsg.h is not built on Unix<=
/span>
missingInclude:src/openvpnserv/common.c:25
# IGN: strlen(NULL) is not nice code, but seems to work
d=
iff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index 718cd8b..eaca86b 100644
--- a/src/openvpn/dco_=
freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@=
@ -842,6 +842,7 @@
retry:
buf =3D realloc(buf, buf_size);
+ check_malloc_return(buf);
drv.i=
fd_len =3D buf_size;
drv.ifd_data =3D buf;
<=
span>
To view, visit change 1669. To unsub=
scribe, or for help writing mail filters, visit settings.
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icd8ea093dfe9f1888570f3d7b78=
6b951b5262e47
Gerrit-Change-Number: 1669
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...=
.>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...=
.1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...=
ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...=
..1227...>
=
--7ua+J8t9Ubk=--