Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/1992?usp=email

to review the following change.


Change subject: PUSH_UPDATE server: free temporary options after sending message
......................................................................

PUSH_UPDATE server: free temporary options after sending message

Clean up options on success and send failure to avoid leaking
memory allocated while parsing outgoing updates.

Change-Id: Ie4a7e0702a30d2a637c3dfe03f6c62d8a9901aae
Signed-off-by: Marco Baffo <[email protected]>
---
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/mock_push_dependencies.c
2 files changed, 9 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1992/1

diff --git a/src/openvpn/push_util.c b/src/openvpn/push_util.c
index 0213041..f867a8c 100644
--- a/src/openvpn/push_util.c
+++ b/src/openvpn/push_util.c
@@ -163,6 +163,7 @@
     {
         if (!send_control_channel_string(c, BSTR(&e->buf), D_PUSH))
         {
+            uninit_options(&o);
             return false;
         }

@@ -217,6 +218,7 @@
         update_vhash(m, mi, o.ifconfig_local, o.ifconfig_ipv6_local);
     }

+    uninit_options(&o);
     return true;
 }

diff --git a/tests/unit_tests/openvpn/mock_push_dependencies.c 
b/tests/unit_tests/openvpn/mock_push_dependencies.c
index 112bcfd..bf2ccf3 100644
--- a/tests/unit_tests/openvpn/mock_push_dependencies.c
+++ b/tests/unit_tests/openvpn/mock_push_dependencies.c
@@ -62,6 +62,13 @@
 {
 }

+void
+uninit_options(struct options *options)
+{
+    gc_free(&options->gc);
+    gc_free(&options->dns_options.gc);
+}
+
 bool
 options_postprocess_pull(struct options *options, struct env_set *es)
 {

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie4a7e0702a30d2a637c3dfe03f6c62d8a9901aae
Gerrit-Change-Number: 1992
Gerrit-PatchSet: 1
Gerrit-Owner: Marco Baffo <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to