From: Dirk Lemstra Date: Sat, 16 Sep 2017 07:18:03 +0000 (+0200) Subject: Fixed initialization of type_cache and module_list. X-Git-Tag: 7.0.7-3~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba2b6ba48be0a8f8c53a588e9d6ef6b72c910ea7;p=imagemagick Fixed initialization of type_cache and module_list. --- diff --git a/MagickCore/module.c b/MagickCore/module.c index f49ea75a2..5539ccda6 100644 --- a/MagickCore/module.c +++ b/MagickCore/module.c @@ -870,20 +870,24 @@ static MagickBooleanType IsModuleTreeInstantiated() ModuleInfo *module_info; - module_list=NewSplayTree(CompareSplayTreeString, + SplayTreeInfo + *splay_tree; + + splay_tree=NewSplayTree(CompareSplayTreeString, (void *(*)(void *)) NULL,DestroyModuleNode); - if (module_list == (SplayTreeInfo *) NULL) + if (splay_tree == (SplayTreeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError, "MemoryAllocationFailed"); module_info=AcquireModuleInfo((const char *) NULL,"[boot-strap]"); module_info->stealth=MagickTrue; - status=AddValueToSplayTree(module_list,module_info->tag,module_info); + status=AddValueToSplayTree(splay_tree,module_info->tag,module_info); if (status == MagickFalse) ThrowFatalException(ResourceLimitFatalError, "MemoryAllocationFailed"); if (lt_dlinit() != 0) ThrowFatalException(ModuleFatalError, "UnableToInitializeModuleLoader"); + module_list=splay_tree; } UnlockSemaphoreInfo(module_semaphore); } diff --git a/MagickCore/type.c b/MagickCore/type.c index 73ddcecf2..2b47563df 100644 --- a/MagickCore/type.c +++ b/MagickCore/type.c @@ -897,13 +897,17 @@ static MagickBooleanType IsTypeTreeInstantiated(ExceptionInfo *exception) LockSemaphoreInfo(type_semaphore); if (type_cache == (SplayTreeInfo *) NULL) { - type_cache=AcquireTypeCache(MagickTypeFilename,exception); + SplayTreeInfo + *splay_tree; + + splay_tree=AcquireTypeCache(MagickTypeFilename,exception); #if defined(MAGICKCORE_WINDOWS_SUPPORT) - (void) NTAcquireTypeCache(type_cache,exception); + (void) NTAcquireTypeCache(splay_tree,exception); #endif #if defined(MAGICKCORE_FONTCONFIG_DELEGATE) - (void) LoadFontConfigFonts(type_cache,exception); + (void) LoadFontConfigFonts(splay_tree,exception); #endif + type_cache=splay_tree; } UnlockSemaphoreInfo(type_semaphore); }