diff --git a/MagickCore/coder.c b/MagickCore/coder.c index f4def8f..9db3547 100644 --- a/MagickCore/coder.c +++ b/MagickCore/coder.c
@@ -324,15 +324,23 @@ MagickExport const CoderInfo *GetCoderInfo(const char *name, ExceptionInfo *exception) { + const CoderInfo + *coder_info; + assert(exception != (ExceptionInfo *) NULL); if (IsCoderTreeInstantiated(exception) == MagickFalse) return((const CoderInfo *) NULL); + LockSemaphoreInfo(coder_semaphore); if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) { ResetSplayTreeIterator(coder_list); - return((const CoderInfo *) GetNextValueInSplayTree(coder_list)); + coder_info=(const CoderInfo *) GetNextValueInSplayTree(coder_list); + UnlockSemaphoreInfo(coder_semaphore); + return(coder_info); } - return((const CoderInfo *) GetValueFromSplayTree(coder_list,name)); + coder_info=(const CoderInfo *) GetValueFromSplayTree(coder_list,name); + UnlockSemaphoreInfo(coder_semaphore); + return(coder_info); } /*
diff --git a/MagickCore/color.c b/MagickCore/color.c index ddf673a..d182058 100644 --- a/MagickCore/color.c +++ b/MagickCore/color.c
@@ -912,12 +912,12 @@ if (color_list == (LinkedListInfo *) NULL) if (IfMagickFalse(IsColorListInstantiated(exception))) return((const ColorInfo *) NULL); - if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) - return((const ColorInfo *) GetValueFromLinkedList(color_list,0)); /* Strip names of whitespace. */ - (void) CopyMagickString(colorname,name,MaxTextExtent); + *colorname='\0'; + if (name != (const char *) NULL) + (void) CopyMagickString(colorname,name,MaxTextExtent); for (q=colorname; *q != '\0'; q++) { if (isspace((int) ((unsigned char) *q)) == 0) @@ -931,6 +931,11 @@ LockSemaphoreInfo(color_semaphore); ResetLinkedListIterator(color_list); p=(const ColorInfo *) GetNextValueInLinkedList(color_list); + if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) + { + UnlockSemaphoreInfo(color_semaphore); + return(p); + } while (p != (const ColorInfo *) NULL) { if (((p->compliance & compliance) != 0) &&
diff --git a/MagickCore/configure.c b/MagickCore/configure.c index b102d2c..5985d1b 100644 --- a/MagickCore/configure.c +++ b/MagickCore/configure.c
@@ -266,14 +266,17 @@ assert(exception != (ExceptionInfo *) NULL); if (IsConfigureListInstantiated(exception) == MagickFalse) return((const ConfigureInfo *) NULL); - if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) - return((const ConfigureInfo *) GetValueFromLinkedList(configure_list,0)); /* Search for configure tag. */ LockSemaphoreInfo(configure_semaphore); ResetLinkedListIterator(configure_list); p=(const ConfigureInfo *) GetNextValueInLinkedList(configure_list); + if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) + { + UnlockSemaphoreInfo(configure_semaphore); + return(p); + } while (p != (const ConfigureInfo *) NULL) { if (LocaleCompare(name,p->name) == 0)
diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c index 581698a..ce6d84e 100644 --- a/MagickCore/delegate.c +++ b/MagickCore/delegate.c
@@ -369,14 +369,17 @@ if (delegate_list == (LinkedListInfo *) NULL) if( IfMagickFalse(IsDelegateListInstantiated(exception)) ) return((const DelegateInfo *) NULL); - if ((LocaleCompare(decode,"*") == 0) && (LocaleCompare(encode,"*") == 0)) - return((const DelegateInfo *) GetValueFromLinkedList(delegate_list,0)); /* Search for named delegate. */ LockSemaphoreInfo(delegate_semaphore); ResetLinkedListIterator(delegate_list); p=(const DelegateInfo *) GetNextValueInLinkedList(delegate_list); + if ((LocaleCompare(decode,"*") == 0) && (LocaleCompare(encode,"*") == 0)) + { + UnlockSemaphoreInfo(delegate_semaphore); + return(p); + } while (p != (const DelegateInfo *) NULL) { if (p->mode > 0)
diff --git a/MagickCore/locale.c b/MagickCore/locale.c index e336f45..2f1452c 100644 --- a/MagickCore/locale.c +++ b/MagickCore/locale.c
@@ -420,15 +420,23 @@ MagickExport const LocaleInfo *GetLocaleInfo_(const char *tag, ExceptionInfo *exception) { + const LocaleInfo + *locale_info; + assert(exception != (ExceptionInfo *) NULL); if (IsLocaleTreeInstantiated(exception) == MagickFalse) return((const LocaleInfo *) NULL); + LockSemaphoreInfo(locale_semaphore); if ((tag == (const char *) NULL) || (LocaleCompare(tag,"*") == 0)) { ResetSplayTreeIterator(locale_list); - return((const LocaleInfo *) GetNextValueInSplayTree(locale_list)); + locale_info=(const LocaleInfo *) GetNextValueInSplayTree(locale_list); + UnlockSemaphoreInfo(locale_semaphore); + return(locale_info); } - return((const LocaleInfo *) GetValueFromSplayTree(locale_list,tag)); + locale_info=(const LocaleInfo *) GetValueFromSplayTree(locale_list,tag); + UnlockSemaphoreInfo(locale_semaphore); + return(locale_info); } /*
diff --git a/MagickCore/log.c b/MagickCore/log.c index 889caed..0ebd2b8 100644 --- a/MagickCore/log.c +++ b/MagickCore/log.c
@@ -184,6 +184,7 @@ *log_list = (LinkedListInfo *) NULL; static SemaphoreInfo + *event_semaphore = (SemaphoreInfo *) NULL, *log_semaphore = (SemaphoreInfo *) NULL; /* @@ -273,14 +274,17 @@ assert(exception != (ExceptionInfo *) NULL); if (IsLogListInstantiated(exception) == MagickFalse) return((LogInfo *) NULL); - if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) - return((LogInfo *) GetValueFromLinkedList(log_list,0)); /* Search for log tag. */ LockSemaphoreInfo(log_semaphore); ResetLinkedListIterator(log_list); p=(LogInfo *) GetNextValueInLinkedList(log_list); + if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) + { + UnlockSemaphoreInfo(log_semaphore); + return(p); + } while (p != (LogInfo *) NULL) { if (LocaleCompare(name,p->name) == 0)
diff --git a/MagickCore/magic.c b/MagickCore/magic.c index 77864e9..c70552f 100644 --- a/MagickCore/magic.c +++ b/MagickCore/magic.c
@@ -254,8 +254,6 @@ assert(exception != (ExceptionInfo *) NULL); if (IsMagicListInstantiated(exception) == MagickFalse) return((const MagicInfo *) NULL); - if (magic == (const unsigned char *) NULL) - return((const MagicInfo *) GetValueFromLinkedList(magic_list,0)); if (length == 0) return((const MagicInfo *) NULL); /* @@ -264,6 +262,11 @@ LockSemaphoreInfo(magic_semaphore); ResetLinkedListIterator(magic_list); p=(const MagicInfo *) GetNextValueInLinkedList(magic_list); + if (magic == (const unsigned char *) NULL) + { + UnlockSemaphoreInfo(magic_semaphore); + return(p); + } while (p != (const MagicInfo *) NULL) { assert(p->offset >= 0);
diff --git a/MagickCore/magick.c b/MagickCore/magick.c index 9d1ef3c..da6528f 100644 --- a/MagickCore/magick.c +++ b/MagickCore/magick.c
@@ -414,24 +414,23 @@ assert(exception != (ExceptionInfo *) NULL); if (IsMagickTreeInstantiated(exception) == MagickFalse) return((const MagickInfo *) NULL); - if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) - { -#if defined(MAGICKCORE_MODULES_SUPPORT) - if (LocaleCompare(name,"*") == 0) - (void) OpenModules(exception); -#endif - LockSemaphoreInfo(magick_semaphore); - ResetSplayTreeIterator(magick_list); - p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); - UnlockSemaphoreInfo(magick_semaphore); - return(p); - } /* Find name in list. */ LockSemaphoreInfo(magick_semaphore); ResetSplayTreeIterator(magick_list); p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); + if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) + { +#if defined(MAGICKCORE_MODULES_SUPPORT) + if (LocaleCompare(name,"*") == 0) + (void) OpenModules(exception); +#endif + ResetSplayTreeIterator(magick_list); + p=(const MagickInfo *) GetNextValueInSplayTree(magick_list); + UnlockSemaphoreInfo(magick_semaphore); + return(p); + } while (p != (const MagickInfo *) NULL) { if (LocaleCompare(p->name,name) == 0)
diff --git a/MagickCore/mime.c b/MagickCore/mime.c index 414e8f2..56fef38 100644 --- a/MagickCore/mime.c +++ b/MagickCore/mime.c
@@ -320,7 +320,7 @@ (void) InsertValueInLinkedList(mime_list,0, RemoveElementByValueFromLinkedList(mime_list,p)); UnlockSemaphoreInfo(mime_semaphore); - return(mime_info); + return(p); } /*
diff --git a/MagickCore/module.c b/MagickCore/module.c index 611d2d6..4051ddd 100644 --- a/MagickCore/module.c +++ b/MagickCore/module.c
@@ -215,24 +215,26 @@ */ MagickExport ModuleInfo *GetModuleInfo(const char *tag,ExceptionInfo *exception) { + ModuleInfo + *module_info; + if (IsModuleTreeInstantiated(exception) == MagickFalse) return((ModuleInfo *) NULL); + LockSemaphoreInfo(module_semaphore); + ResetSplayTreeIterator(module_list); if ((tag == (const char *) NULL) || (LocaleCompare(tag,"*") == 0)) { - ModuleInfo - *p; - #if defined(MAGICKCORE_MODULES_SUPPORT) if (LocaleCompare(tag,"*") == 0) (void) OpenModules(exception); #endif - LockSemaphoreInfo(module_semaphore); - ResetSplayTreeIterator(module_list); - p=(ModuleInfo *) GetNextValueInSplayTree(module_list); + module_info=(ModuleInfo *) GetNextValueInSplayTree(module_list); UnlockSemaphoreInfo(module_semaphore); - return(p); + return(module_info); } - return((ModuleInfo *) GetValueFromSplayTree(module_list,tag)); + module_info=(ModuleInfo *) GetValueFromSplayTree(module_list,tag); + UnlockSemaphoreInfo(module_semaphore); + return(module_info); } /*
diff --git a/MagickCore/policy.c b/MagickCore/policy.c index 2010505..943a815 100644 --- a/MagickCore/policy.c +++ b/MagickCore/policy.c
@@ -171,12 +171,12 @@ assert(exception != (ExceptionInfo *) NULL); if (IsPolicyListInstantiated(exception) == MagickFalse) return((PolicyInfo *) NULL); - if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) - return((PolicyInfo *) GetValueFromLinkedList(policy_list,0)); /* Strip names of whitespace. */ - (void) CopyMagickString(policyname,name,MaxTextExtent); + *policyname='\0'; + if (name != (const char *) NULL) + (void) CopyMagickString(policyname,name,MaxTextExtent); for (q=policyname; *q != '\0'; q++) { if (isspace((int) ((unsigned char) *q)) == 0) @@ -190,6 +190,11 @@ LockSemaphoreInfo(policy_semaphore); ResetLinkedListIterator(policy_list); p=(PolicyInfo *) GetNextValueInLinkedList(policy_list); + if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) + { + UnlockSemaphoreInfo(policy_semaphore); + return(p); + } while (p != (PolicyInfo *) NULL) { if (LocaleCompare(policyname,p->name) == 0)
diff --git a/MagickCore/type.c b/MagickCore/type.c index 59e5eb9..b727289 100644 --- a/MagickCore/type.c +++ b/MagickCore/type.c
@@ -158,12 +158,17 @@ assert(exception != (ExceptionInfo *) NULL); if (IsTypeTreeInstantiated(exception) == MagickFalse) return((const TypeInfo *) NULL); + LockSemaphoreInfo(type_semaphore); if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) { ResetSplayTreeIterator(type_list); - return((const TypeInfo *) GetNextValueInSplayTree(type_list)); + type_info=(const TypeInfo *) GetNextValueInSplayTree(type_list); + UnlockSemaphoreInfo(type_semaphore); + return(type_info); } - return((const TypeInfo *) GetValueFromSplayTree(type_list,name)); + type_info=(const TypeInfo *) GetValueFromSplayTree(type_list,name); + UnlockSemaphoreInfo(type_semaphore); + return(type_info); } /*