diff -Nur libtool-1.4.2.orig/libltdl/ltdl.c libtool-1.4.2/libltdl/ltdl.c --- libtool-1.4.2.orig/libltdl/ltdl.c Thu Dec 19 15:19:48 2002 +++ libtool-1.4.2/libltdl/ltdl.c Thu Dec 19 15:58:01 2002 @@ -2847,15 +2847,20 @@ #endif ))) { - tryall_dlopen (&newhandle, filename); + if (tryall_dlopen (&newhandle, filename) != 0){ + LT_DLFREE (*phandle); + ++errors; + goto cleanup; + } } - - if (!newhandle) - { + else + { LT_DLFREE (*phandle); ++errors; goto cleanup; } + + assert (newhandle != NULL); } register_handle: