Skip to content

Commit a8674b2

Browse files
committed
set libhandle to NULL when closing the shared lib
1 parent 053d61d commit a8674b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/vmp_stack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static void * libhandle = NULL;
523523

524524
int vmp_native_enable(void) {
525525
#ifdef VMPROF_LINUX
526-
if (!unw_get_reg) {
526+
if (libhandle == NULL) {
527527
if ((libhandle = dlopen(LIBUNWIND, RTLD_LAZY | RTLD_LOCAL)) == NULL) {
528528
goto bail_out;
529529
}
@@ -570,6 +570,7 @@ void vmp_native_disable(void) {
570570
vmprof_error = dlerror();
571571
fprintf(stderr, "could not close libunwind at runtime. error: %s\n", vmprof_error);
572572
}
573+
libhandle = NULL;
573574
}
574575

575576
vmp_native_traces_enabled = 0;

0 commit comments

Comments
 (0)