Skip to contentSkip to conversation

Change in openvpn[master]: Fix memory leak in ntlm_support

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Dec 9, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1733766865000.If472398d4ff8323de485f084a07160b365dfc501@...2715...

#1 lore raw

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/+/826?usp=email

to review the following change.

Change subject: Fix memory leak in ntlm_support
......................................................................

Fix memory leak in ntlm_support

Not really important but prevents running the NTLM t_client tests with ASAN enabled.

Change-Id If472398d4ff8323de485f084a07160b365dfc501

---
M tests/ntlm_support.c

1 file changed, 8 insertions(+), 4 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/826/1

tests/ntlm_support.c +8 -4
index ccf8962..18d555a 100644
@@ -33,11 +33,11 @@
 int
 main(void)
 {
-#if defined(ENABLE_CRYPTO_OPENSSL)
-    crypto_load_provider("legacy");
-    crypto_load_provider("default");
-#endif
 #ifdef NTLM
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    provider_t *legacy = crypto_load_provider("legacy");
+    provider_t *def = crypto_load_provider("default");
+#endif
     if (!md_valid("MD4"))
     {
         msg(M_FATAL, "MD4 not supported");
@@ -46,6 +46,10 @@
     {
         msg(M_FATAL, "MD5 not supported");
     }
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    crypto_unload_provider("legacy", legacy);
+    crypto_unload_provider("default", def);
+#endif
 #else  /* ifdef NTLM */
     msg(M_FATAL, "NTLM support not compiled in");
 #endif

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/826?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If472398d4ff8323de485f084a07160b365dfc501
Gerrit-Change-Number: 826
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/826?usp=email )

Change subject: Fix memory leak in ntlm_support
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/826?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If472398d4ff8323de485f084a07160b365dfc501
Gerrit-Change-Number: 826
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 09 Dec 2024 19:47:39 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 Fix memory leak in ntlm_support

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Not really important but prevents running the NTLM t_client tests with ASAN enabled.

Change-Id If472398d4ff8323de485f084a07160b365dfc501

---

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/+/826
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Lev Stipakov <[email protected]...>

tests/ntlm_support.c +8 -4
index ccf8962..18d555a 100644
@@ -33,11 +33,11 @@
 int
 main(void)
 {
-#if defined(ENABLE_CRYPTO_OPENSSL)
-    crypto_load_provider("legacy");
-    crypto_load_provider("default");
-#endif
 #ifdef NTLM
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    provider_t *legacy = crypto_load_provider("legacy");
+    provider_t *def = crypto_load_provider("default");
+#endif
     if (!md_valid("MD4"))
     {
         msg(M_FATAL, "MD4 not supported");
@@ -46,6 +46,10 @@
     {
         msg(M_FATAL, "MD5 not supported");
     }
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    crypto_unload_provider("legacy", legacy);
+    crypto_unload_provider("default", def);
+#endif
 #else  /* ifdef NTLM */
     msg(M_FATAL, "NTLM support not compiled in");
 #endif
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Fix memory leak in ntlm_support

Haven't really tested but looks reasonable and still works as expected on the OpenSSL test instance here.

Your patch has been applied to the master branch.

commit ae82631be17ca8c49d356510c9e7709ddcf19db3

Author: Frank Lichtenheld
Date:   Mon Dec 9 20:49:57 2024 +0100
     Fix memory leak in ntlm_support

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Lev Stipakov <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg30049.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/826?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by stipa

Change subject: Fix memory leak in ntlm_support
......................................................................

Fix memory leak in ntlm_support

Not really important but prevents running the NTLM t_client tests with ASAN enabled.

Change-Id If472398d4ff8323de485f084a07160b365dfc501

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30049.html

---
M tests/ntlm_support.c

1 file changed, 8 insertions(+), 4 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/826/2

tests/ntlm_support.c +8 -4
index ccf8962..18d555a 100644
@@ -33,11 +33,11 @@
 int
 main(void)
 {
-#if defined(ENABLE_CRYPTO_OPENSSL)
-    crypto_load_provider("legacy");
-    crypto_load_provider("default");
-#endif
 #ifdef NTLM
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    provider_t *legacy = crypto_load_provider("legacy");
+    provider_t *def = crypto_load_provider("default");
+#endif
     if (!md_valid("MD4"))
     {
         msg(M_FATAL, "MD4 not supported");
@@ -46,6 +46,10 @@
     {
         msg(M_FATAL, "MD5 not supported");
     }
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    crypto_unload_provider("legacy", legacy);
+    crypto_unload_provider("default", def);
+#endif
 #else  /* ifdef NTLM */
     msg(M_FATAL, "NTLM support not compiled in");
 #endif

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/826?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If472398d4ff8323de485f084a07160b365dfc501
Gerrit-Change-Number: 826
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/826?usp=email )

Change subject: Fix memory leak in ntlm_support
......................................................................

Fix memory leak in ntlm_support

Not really important but prevents running the NTLM t_client tests with ASAN enabled.

Change-Id If472398d4ff8323de485f084a07160b365dfc501

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30049.html

---
M tests/ntlm_support.c

1 file changed, 8 insertions(+), 4 deletions(-)
tests/ntlm_support.c +8 -4
index ccf8962..18d555a 100644
@@ -33,11 +33,11 @@
 int
 main(void)
 {
-#if defined(ENABLE_CRYPTO_OPENSSL)
-    crypto_load_provider("legacy");
-    crypto_load_provider("default");
-#endif
 #ifdef NTLM
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    provider_t *legacy = crypto_load_provider("legacy");
+    provider_t *def = crypto_load_provider("default");
+#endif
     if (!md_valid("MD4"))
     {
         msg(M_FATAL, "MD4 not supported");
@@ -46,6 +46,10 @@
     {
         msg(M_FATAL, "MD5 not supported");
     }
+#if defined(ENABLE_CRYPTO_OPENSSL)
+    crypto_unload_provider("legacy", legacy);
+    crypto_unload_provider("default", def);
+#endif
 #else  /* ifdef NTLM */
     msg(M_FATAL, "NTLM support not compiled in");
 #endif

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/826?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: If472398d4ff8323de485f084a07160b365dfc501
Gerrit-Change-Number: 826
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged