Gert Doering has submitted this change. ( 
https://gerrit.openvpn.net/c/openvpn/+/2149?usp=email )

Change subject: Remove unused gc_arena variables
......................................................................

Remove unused gc_arena variables

These functions create and free a gc_arena they never allocate from.

Change-Id: Iefcc3cb90f3e6b036a584a74268678dbc17da69f
Signed-off-by: Razvan Cojocaru <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2149
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg40981.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/init.c
M src/openvpn/manage.c
M src/openvpn/multi.c
M src/openvpn/options_string.c
M src/openvpn/plugin.c
M src/openvpn/route.c
M src/openvpn/socket.c
M src/openvpn/tun.c
8 files changed, 0 insertions(+), 32 deletions(-)




diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index ff3bfe5..3bc4de4 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -117,8 +117,6 @@
             const char *ifconfig_remote, const char *context, const char 
*signal_text,
             const char *script_type, struct env_set *es)
 {
-    struct gc_arena gc = gc_new();
-
     if (signal_text)
     {
         setenv_str(es, "signal", signal_text);
@@ -174,8 +172,6 @@
         openvpn_run_script(&argv, es, S_FATAL, "--up/--down");
         argv_free(&argv);
     }
-
-    gc_free(&gc);
 }

 /*
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 3e3b1c2..581e7be 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -2325,9 +2325,7 @@

     if (!ignore_sys_error(err, crt_error))
     {
-        struct gc_arena gc = gc_new();
         msg(D_MANAGEMENT, "MANAGEMENT: TCP %s error: %s", prefix, 
strerror(err));
-        gc_free(&gc);
         return true;
     }
     else
@@ -3151,11 +3149,8 @@
 management_notify_client_cr_response(unsigned mda_key_id, const struct 
man_def_auth_context *mdac,
                                      const struct env_set *es, const char 
*response)
 {
-    struct gc_arena gc;
     if (management)
     {
-        gc = gc_new();
-
         msg(M_CLIENT, ">CLIENT:CR_RESPONSE,%lu,%u,%s", mdac->cid, mda_key_id, 
response);
         man_output_extra_env(management, "CLIENT");
         if (management->connection.env_filter_level > 0)
@@ -3163,7 +3158,6 @@
             man_output_peer_info_env(management, mdac);
         }
         man_output_env(es, true, management->connection.env_filter_level, 
"CLIENT");
-        gc_free(&gc);
     }
 }

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 03844fb..bcaa012 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -726,7 +726,6 @@
 multi_create_instance(struct multi_context *m, const struct mroute_addr *real,
                       struct link_socket *sock)
 {
-    struct gc_arena gc = gc_new();
     struct multi_instance *mi;

     msg(D_MULTI_MEDIUM, "MULTI: multi_create_instance called");
@@ -792,12 +791,10 @@
     mi->ev_arg.type = EVENT_ARG_MULTI_INSTANCE;
     mi->ev_arg.u.mi = mi;

-    gc_free(&gc);
     return mi;

 err:
     multi_close_instance(m, mi, false);
-    gc_free(&gc);
     return NULL;
 }

@@ -2213,7 +2210,6 @@
     if (mi->context.options.client_connect_script)
     {
         struct argv argv = argv_new();
-        struct gc_arena gc = gc_new();

         setenv_str(mi->context.c2.es, "script_type", "client-connect");

@@ -2249,7 +2245,6 @@
             ccs_delete_deferred_ret_file(mi);
         }
         argv_free(&argv);
-        gc_free(&gc);
     }
     return ret;
 }
diff --git a/src/openvpn/options_string.c b/src/openvpn/options_string.c
index cfc0595..ed4d742 100644
--- a/src/openvpn/options_string.c
+++ b/src/openvpn/options_string.c
@@ -344,7 +344,6 @@
 bool
 options_cmp_equal_safe(char *actual, const char *expected, size_t actual_n)
 {
-    struct gc_arena gc = gc_new();
     bool ret = true;

     if (actual_n > 0)
@@ -360,7 +359,6 @@
             ret = !strcmp(actual, expected);
         }
     }
-    gc_free(&gc);
     return ret;
 }

diff --git a/src/openvpn/plugin.c b/src/openvpn/plugin.c
index 08461b8..d1f228e 100644
--- a/src/openvpn/plugin.c
+++ b/src/openvpn/plugin.c
@@ -560,7 +560,6 @@

     if (p->plugin_handle && (p->plugin_type_mask & OPENVPN_PLUGIN_MASK(type)))
     {
-        struct gc_arena gc = gc_new();
         struct argv a = argv_insert_head(av, p->so_pathname);

         dmsg(D_PLUGIN_DEBUG, "PLUGIN_CALL: PRE type=%s", 
plugin_type_name(type));
@@ -609,7 +608,6 @@
         }

         argv_free(&a);
-        gc_free(&gc);
     }
     return status;
 }
diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 53550c4..d0d26c6 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -3090,7 +3090,6 @@
 void
 get_default_gateway(struct route_gateway_info *rgi, in_addr_t dest, 
openvpn_net_ctx_t *ctx)
 {
-    struct gc_arena gc = gc_new();
     int sd = -1;
     char best_name[IFNAMSIZ];

@@ -3216,7 +3215,6 @@
     {
         close(sd);
     }
-    gc_free(&gc);
 }

 /* IPv6 implementation using netlink
diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c
index 307b5c6..1fbd07b 100644
--- a/src/openvpn/socket.c
+++ b/src/openvpn/socket.c
@@ -499,7 +499,6 @@
                      const struct addrinfo *local, bool do_listen,
                      bool nowait, volatile int *signal_received)
 {
-    struct gc_arena gc = gc_new();
     socket_descriptor_t new_sd = SOCKET_UNDEFINED;

     CLEAR(*act);
@@ -521,7 +520,6 @@
         get_signal(signal_received);
         if (*signal_received)
         {
-            gc_free(&gc);
             return sd;
         }

@@ -552,7 +550,6 @@

     tcp_connection_established(act);

-    gc_free(&gc);
     return new_sd;
 }

@@ -803,8 +800,6 @@
 static void
 resolve_bind_local(struct link_socket *sock)
 {
-    struct gc_arena gc = gc_new();
-
     /* resolve local address if undefined */
     if (!sock->info.lsa->bind_local)
     {
@@ -846,8 +841,6 @@
             sock->info.af = (sa_family_t)sock->info.lsa->bind_local->ai_family;
         }
     }
-
-    gc_free(&gc);
 }

 static void
@@ -2673,7 +2666,6 @@
 void
 socket_bind_unix(socket_descriptor_t sd, struct sockaddr_un *local, const char 
*prefix)
 {
-    struct gc_arena gc = gc_new();
     const mode_t orig_umask = umask(0);

     if (bind(sd, (struct sockaddr *)local, sizeof(struct sockaddr_un)))
@@ -2683,7 +2675,6 @@
     }

     umask(orig_umask);
-    gc_free(&gc);
 }

 socket_descriptor_t
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 943ad9f..bcea331 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -666,7 +666,6 @@
 void
 warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx)
 {
-    struct gc_arena gc = gc_new();
     struct route_gateway_info rgi;
     const unsigned int needed = (RGI_ADDR_DEFINED | RGI_NETMASK_DEFINED);

@@ -680,7 +679,6 @@
                 "NOTE: your local LAN uses the extremely common subnet address 
192.168.0.x or 192.168.1.x.  Be aware that this might create routing conflicts 
if you connect to the VPN server from public locations such as internet cafes 
that use the same subnet.");
         }
     }
-    gc_free(&gc);
 }

 /*

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

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iefcc3cb90f3e6b036a584a74268678dbc17da69f
Gerrit-Change-Number: 2149
Gerrit-PatchSet: 2
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Frank Lichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to