diff --git a/ChangeLog b/ChangeLog index 714598a78..c96630b54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ Coverity #1053: Nuke a dead variable. Coverity #269: Compare the requested ABI class against the ABI class of the module, not the module class. + Coverity #794: Fix a highly unlikely memory leak. * miext/cw/cw.c: Coverity #337: Remove useless NULL check. diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index a887e2597..b14914eb5 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -418,10 +418,6 @@ FindModule(const char *module, const char *dir, const char **subdirlist, #else const char suffix[3][3] = { "a", "o", "so" }; #endif - - subdirs = InitSubdirs(subdirlist); - if (!subdirs) - return NULL; #ifndef __EMX__ dirpath = (char *)dir; @@ -431,7 +427,10 @@ FindModule(const char *module, const char *dir, const char **subdirlist, #endif if (strlen(dirpath) > PATH_MAX) return NULL; - /*xf86Msg(X_INFO,"OS2DIAG: FindModule: dirpath=%s\n",dirpath); */ + + subdirs = InitSubdirs(subdirlist); + if (!subdirs) + return NULL; for (s = subdirs; *s; s++) { if ((dirlen = strlen(dirpath) + strlen(*s)) > PATH_MAX)