]> granicus.if.org Git - imagemagick/commitdiff
Added extra check to make sure the magick_list is properly initialized.
authorDirk Lemstra <dirk@git.imagemagick.org>
Sat, 16 Sep 2017 07:27:28 +0000 (09:27 +0200)
committerDirk Lemstra <dirk@git.imagemagick.org>
Sat, 16 Sep 2017 07:27:28 +0000 (09:27 +0200)
MagickCore/magick.c

index 7f2b23415f6b49413871959f07f11a151e2b9b34..1c590f9ad233f98bc4659b9156b4a9dd36fdf3fe 100644 (file)
@@ -125,7 +125,8 @@ static SplayTreeInfo
 
 static volatile MagickBooleanType
   instantiate_magickcore = MagickFalse,
-  magickcore_signal_in_progress = MagickFalse;
+  magickcore_signal_in_progress = MagickFalse,
+  magick_list_initialized = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -1019,12 +1020,12 @@ static void *DestroyMagickNode(void *magick_info)
 
 static MagickBooleanType IsMagickTreeInstantiated(ExceptionInfo *exception)
 {
-  if (magick_list == (SplayTreeInfo *) NULL)
+  if (magick_list_initialized == MagickFalse)
     {
       if (magick_semaphore == (SemaphoreInfo *) NULL)
         ActivateSemaphoreInfo(&magick_semaphore);
       LockSemaphoreInfo(magick_semaphore);
-      if (magick_list == (SplayTreeInfo *) NULL)
+      if (magick_list_initialized == MagickFalse)
         {
           magick_list=NewSplayTree(CompareSplayTreeString,(void *(*)(void *))
             NULL,DestroyMagickNode);
@@ -1037,6 +1038,7 @@ static MagickBooleanType IsMagickTreeInstantiated(ExceptionInfo *exception)
 #if !defined(MAGICKCORE_BUILD_MODULES)
           RegisterStaticModules();
 #endif
+          magick_list_initialized=MagickTrue;
         }
       UnlockSemaphoreInfo(magick_semaphore);
     }