summaryrefslogtreecommitdiff
path: root/ext/dl/handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/dl/handle.c')
-rw-r--r--ext/dl/handle.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index 0ba4397010..4b0a129793 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -75,6 +75,9 @@ rb_dlhandle_initialize(int argc, VALUE argv[], VALUE self)
};
#endif
Data_Get_Struct(self, struct dl_handle, dlhandle);
+ if( dlhandle->ptr && dlhandle->open && dlhandle->enable_close ){
+ dlclose(dlhandle->ptr);
+ }
dlhandle->ptr = ptr;
dlhandle->open = 1;
dlhandle->enable_close = 0;