summaryrefslogtreecommitdiff
path: root/dln.c
diff options
context:
space:
mode:
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/dln.c b/dln.c
index 0edd709bbe..77bfe91b28 100644
--- a/dln.c
+++ b/dln.c
@@ -392,6 +392,12 @@ dln_open(const char *file)
dln_fatalerror("%s - %s", incompatible, file);
}
else {
+ if (libruby_name) {
+ const size_t len = strlen(libruby_name);
+ char *const tmp = ALLOCA_N(char, len + 1);
+ if (tmp) memcpy(tmp, libruby_name, len + 1);
+ libruby_name = tmp;
+ }
dlclose(handle);
if (libruby_name) {
dln_loaderror("linked to incompatible %s - %s", libruby_name, file);