diff --git a/libltdl/lt_dlloader.c b/libltdl/lt_dlloader.c index 2c99a22..eac65e4 100644 --- a/libltdl/lt_dlloader.c +++ b/libltdl/lt_dlloader.c @@ -74,9 +74,21 @@ lt_dlloader_add (const lt_dlvtable *vtable) return RETURN_FAILURE; } + if (vtable->dlloader_init) + { + if ((*vtable->dlloader_init) (vtable->dlloader_data)) + { + LT__SETERROR (INIT_LOADER); + return RETURN_FAILURE; + } + } + item = slist_box (vtable); if (!item) { + if (vtable->dlloader_exit) + (*vtable->dlloader_exit) (vtable->dlloader_data); + (*lt__alloc_die) (); /* Let the caller know something went wrong if lt__alloc_die diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 1fe272f..9067ad5 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -188,15 +188,6 @@ loader_init (lt_get_vtable *vtable_func, lt_user_data data) assert (errors || vtable); - if ((!errors) && vtable->dlloader_init) - { - if ((*vtable->dlloader_init) (vtable->dlloader_data)) - { - LT__SETERROR (INIT_LOADER); - ++errors; - } - } - return errors; }