From patchwork Thu May 14 09:15:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4937 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:a719:b0:84a:48f:a1fd with SMTP id hl25csp3706571mab; Thu, 14 May 2026 02:15:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AFNElJ8xf1Nsv5Z51TCwxYpOuaTBJiI8FGL4edglsBqf1YfyccsnsCAC1Rh46pqisdA2+ac5ZCCWnls9c9k=@openvpn.net X-Received: by 2002:a05:6820:82a:b0:67d:ea53:b9c8 with SMTP id 006d021491bc7-69b78d821femr4070955eaf.18.1778750138290; Thu, 14 May 2026 02:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778750138; cv=none; d=google.com; s=arc-20240605; b=gKFwSL4Jz/jd1A84ba4yVPcoDTbQ+e5A9fk43V8gEpnNPdHrqmYcb5BEanGZLLNXYf 4M9VUgnKWIDl77jy3akopXzDkIikdMmTBeTEnSh6IA6MsKnf/rksrKDNW1hvAbnjwoQA +c+fDtXTVlrFVOnubZ1tof6wJdKEFhY1b1PZze3uSLKGNzTT+BgOVtxkWmGxMEy4/nmy qeGEIJKGLnO+QrygN0VCGpkKIpMgHcBnfGwx5FPTSSdyaN5M0FizXsa4pQO7a4pO3gOy yLSrCkwJInfLGd4MI9r7Dzq7hsiB6AJxeLjleubvrBUnCtMnq3msvoZgH4mSB32pQ/4a 7tzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=SaY2Oj+CJJIbQDpN+IIfyMGaHqb9U/GZSsnsbRWf0h4=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=fmKL5ojj1XAZXqMix4nrmLGPVMnKaBTV1EElNKcOWOLohG4hPM8qdKQBdfR5FebcrU LUElqfZER1/aZxK0aFedNeELZH8HVLYSHUp1f/gVmKvMKsaoFckuY4wa/ZM3zWj1ZgHC Vfhe1oqJVIVlK7OUMrOfxSdC81J10QuvguFx4fqClLApE7f87+k4TSIXp2TXmuaMn+lN ThcIxd61sx7jtYLosfKcJHufQrWLcon1k4pNf8fNG9LKkBMYdYE0F3cMsQig722u6Up7 9iQpTaX3Kbj34m2nkpN5DInxCowUBO7Xl5WEiFELdQ/qGsB+RazXjuy4wU0M+JFxW4UV Mjjw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="a+21Yiq/"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=GloQwR76; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=P4mZt+NH; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 006d021491bc7-69b8cd3d325si796920eaf.74.2026.05.14.02.15.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2026 02:15:38 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="a+21Yiq/"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=GloQwR76; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=P4mZt+NH; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SaY2Oj+CJJIbQDpN+IIfyMGaHqb9U/GZSsnsbRWf0h4=; b=a+21Yiq/hpvrTKgiIFGW1ciq4S AkTq1w93xuDH2RlTeh4lII4EM9lFlbLHNlazMD5m+op6hB6dmVuLKlIKjYjOOUMJngXKnmTRj73oW qneb0ITKo1xLyo64dD6CS64l4wBjwo/g0aBVyfqNcnxCTEV5yvovmjnivL2RMIIcTh8w=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wNSAI-0006oT-Jq; Thu, 14 May 2026 09:15:35 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wNSA9-0006nZ-8w for openvpn-devel@lists.sourceforge.net; Thu, 14 May 2026 09:15:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=y+dhLs3/Z4crxtQyYbGmaSUEI38SVS+ztsm3VL51Ikw=; b=GloQwR762quR8vMPDnIZJ0/npn ASTE/m8abUHDl2Jj3g5Iy0AuMCJnOqoXbr7PhnEgW6MHNYzjPlIt3RJY7XpTIt19cnJ3794cCVl4e z8DQrhRlY6w8WtKfLdBdg7giQ0L3rulQrjEjIE2OW3sNR2JU/al5CO7lO2nkZrCnf+U8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=y+dhLs3/Z4crxtQyYbGmaSUEI38SVS+ztsm3VL51Ikw=; b=P4mZt+NHgAvNLbq4QdyXYrqeeU aGLola8inBCyMtz/2BYV0263DNU9BpZXVdetQaxpPdlh2ReiWoQRkRTY6haG40T1Wp8LOwhcDbSAa wNQ/qt+MfdjcASrb/03LGtDm5AjG6z2vipvMYHu1GW8mUeaKAgrrxgFfz5XeH87wf51s=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wNSA7-0002J1-M8 for openvpn-devel@lists.sourceforge.net; Thu, 14 May 2026 09:15:25 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 64E9FCGB017680 for ; Thu, 14 May 2026 11:15:12 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 64E9FCgB017679 for openvpn-devel@lists.sourceforge.net; Thu, 14 May 2026 11:15:12 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 14 May 2026 11:15:06 +0200 Message-ID: <20260514091512.17662-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld Identified by cppcheck. Change-Id: Iad3f0c36ac3795fa6a13f2d63bd00ad9c2c30d48 Signed-off-by: Frank Lichtenheld Acked-by: Heiko Hund Gerrit URL: https://gerrit.openvpn.net/c/openvpn/ [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1wNSA7-0002J1-M8 Subject: [Openvpn-devel] [PATCH v2] openvpnserv: Fix memory leak when loading DLLs X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1865154704907874101?= X-GMAIL-MSGID: =?utf-8?q?1865154704907874101?= From: Frank Lichtenheld Identified by cppcheck. Change-Id: Iad3f0c36ac3795fa6a13f2d63bd00ad9c2c30d48 Signed-off-by: Frank Lichtenheld Acked-by: Heiko Hund Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1670 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1670 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Heiko Hund diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index ace25b9..e25c511 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -1071,6 +1071,7 @@ publish_fn_t RtlPublishWnfStateData; const DWORD WNF_GPOL_SYSTEM_CHANGES_HI = 0x0D891E2A; const DWORD WNF_GPOL_SYSTEM_CHANGES_LO = 0xA3BC0875; + BOOL ret = FALSE; HMODULE ntdll = LoadLibraryA("ntdll.dll"); if (ntdll == NULL) @@ -1081,16 +1082,19 @@ RtlPublishWnfStateData = (publish_fn_t)GetProcAddress(ntdll, "RtlPublishWnfStateData"); if (RtlPublishWnfStateData == NULL) { - return FALSE; + goto cleanup; } if (RtlPublishWnfStateData(WNF_GPOL_SYSTEM_CHANGES_LO, WNF_GPOL_SYSTEM_CHANGES_HI, 0, 0, 0, 0) != ERROR_SUCCESS) { - return FALSE; + goto cleanup; } - return TRUE; + ret = TRUE; +cleanup: + FreeLibrary(ntdll); + return ret; } /** @@ -1106,6 +1110,7 @@ unsigned int Length, INT64 ExplicitScope); publish_fn_t RtlPublishWnfStateData; const INT64 WNF_GPOL_SYSTEM_CHANGES = 0x0D891E2AA3BC0875; + BOOL ret = FALSE; HMODULE ntdll = LoadLibraryA("ntdll.dll"); if (ntdll == NULL) @@ -1116,15 +1121,18 @@ RtlPublishWnfStateData = (publish_fn_t)GetProcAddress(ntdll, "RtlPublishWnfStateData"); if (RtlPublishWnfStateData == NULL) { - return FALSE; + goto cleanup; } if (RtlPublishWnfStateData(WNF_GPOL_SYSTEM_CHANGES, 0, 0, 0, 0) != ERROR_SUCCESS) { - return FALSE; + goto cleanup; } - return TRUE; + ret = TRUE; +cleanup: + FreeLibrary(ntdll); + return ret; } /**