From 770ade1c0dd0c8e46afd59932691da40b5330022 Mon Sep 17 00:00:00 2001
From: Jason Hiser <jdhiser@gmail.com>
Date: Thu, 1 Nov 2018 19:03:25 +0000
Subject: [PATCH] explicltly free-up any thanos-owned object that might be in
 the dlopen-ed object

Former-commit-id: bbce6f938f826cab6cf2f34ff6c0df8cf3d5cf0a
---
 tools/thanos/thanos.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/thanos/thanos.cpp b/tools/thanos/thanos.cpp
index 7ca7befa0..751ac5d1d 100644
--- a/tools/thanos/thanos.cpp
+++ b/tools/thanos/thanos.cpp
@@ -199,7 +199,9 @@ int main(int argc, char *argv[])
                                 close(saved_stderr);
 
 				// cleanup plugin
-				free(argv);
+				free(argv); 
+				argv=nullptr;
+				the_step.reset(); // explicitly get rid of the handle to the library so we can close it.
                                 dlclose(dlhdl);
 				
 				string step_retval_str(to_string(step_retval)+"\n");
-- 
GitLab