trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [09/12] trafficserver git commit: TS-3533: Revert "[TS-3294]: Fix global plugin's dlhandle resource leak"
Date Wed, 22 Apr 2015 16:55:28 GMT
TS-3533: Revert "[TS-3294]: Fix global plugin's dlhandle resource leak"

This reverts commit ad9958b9240f784ce5cf0045fd975d143df2ea0e.

Conflicts:
	proxy/Plugin.cc


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/37b2819b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/37b2819b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/37b2819b

Branch: refs/heads/5.3.x
Commit: 37b2819b746599e591ca15600488356fe546aea9
Parents: bf4ba0c
Author: Phil Sorber <sorber@apache.org>
Authored: Wed Apr 22 10:45:03 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Wed Apr 22 10:45:03 2015 -0600

----------------------------------------------------------------------
 proxy/Plugin.cc | 14 ++++++--------
 proxy/Plugin.h  |  2 --
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/37b2819b/proxy/Plugin.cc
----------------------------------------------------------------------
diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc
index 85db1ea..130cae6 100644
--- a/proxy/Plugin.cc
+++ b/proxy/Plugin.cc
@@ -51,7 +51,8 @@ DLL<PluginRegInfo> plugin_reg_list;
 PluginRegInfo *plugin_reg_current = NULL;
 
 PluginRegInfo::PluginRegInfo()
-  : plugin_registered(false), plugin_path(NULL), plugin_name(NULL), vendor_name(NULL), support_email(NULL),
dlh(NULL)
+  : plugin_registered(false), plugin_path(NULL),
+    plugin_name(NULL), vendor_name(NULL), support_email(NULL)
 {
 }
 
@@ -66,14 +67,13 @@ PluginRegInfo::~PluginRegInfo()
   ats_free(this->plugin_name);
   ats_free(this->vendor_name);
   ats_free(this->support_email);
-  if (dlh)
-    dlclose(dlh);
 }
 
 static bool
 plugin_load(int argc, char *argv[], bool validateOnly)
 {
-  char path[PATH_NAME_MAX];
+  char path[PATH_NAME_MAX + 1];
+  void *handle;
   init_func_t init;
 
   if (argc < 1) {
@@ -100,7 +100,7 @@ plugin_load(int argc, char *argv[], bool validateOnly)
     ElevateAccess access(elevate_access != 0);
 #endif /* TS_USE_POSIX_CAP */
 
-    void *handle = dlopen(path, RTLD_NOW);
+    handle = dlopen(path, RTLD_NOW);
     if (!handle) {
       if (validateOnly) {
         return false;
@@ -113,11 +113,9 @@ plugin_load(int argc, char *argv[], bool validateOnly)
     ink_assert(plugin_reg_current == NULL);
     plugin_reg_current = new PluginRegInfo;
     plugin_reg_current->plugin_path = ats_strdup(path);
-    plugin_reg_current->dlh = handle;
 
-    init = (init_func_t)dlsym(plugin_reg_current->dlh, "TSPluginInit");
+    init = (init_func_t) dlsym(handle, "TSPluginInit");
     if (!init) {
-      delete plugin_reg_current;
       if (validateOnly) {
         return false;
       }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/37b2819b/proxy/Plugin.h
----------------------------------------------------------------------
diff --git a/proxy/Plugin.h b/proxy/Plugin.h
index 9364e61..44f31f8 100644
--- a/proxy/Plugin.h
+++ b/proxy/Plugin.h
@@ -37,8 +37,6 @@ struct PluginRegInfo {
   char *vendor_name;
   char *support_email;
 
-  void *dlh;
-
   LINK(PluginRegInfo, link);
 };
 


Mime
View raw message