]> granicus.if.org Git - imagemagick/commitdiff
bugfix: the id would be changed before it is returned. This would cause a severe...
authorLI Chen <lic3@wangsu.com>
Wed, 13 Sep 2017 03:26:08 +0000 (11:26 +0800)
committerDirk Lemstra <dlemstra@users.noreply.github.com>
Wed, 13 Sep 2017 12:18:45 +0000 (14:18 +0200)
MagickWand/wand.c

index 432c0211e9ea8ecdb6d93d0fff308b33a45ccf13..9db81255e85102f527ca81cc535affe5b5290ffe 100644 (file)
@@ -75,7 +75,7 @@ WandExport size_t AcquireWandId(void)
 {
   static size_t
     id = 0;
-
+  size_t nID = 0;
   if (wand_semaphore == (SemaphoreInfo *) NULL)
     ActivateSemaphoreInfo(&wand_semaphore);
   LockSemaphoreInfo(wand_semaphore);
@@ -85,8 +85,9 @@ WandExport size_t AcquireWandId(void)
   id++;
   (void) AddValueToSplayTree(wand_ids,(const void *) id,(const void *) id);
   instantiate_wand=MagickTrue;
+  nID = id;
   UnlockSemaphoreInfo(wand_semaphore);
-  return(id);
+  return(nID);
 }
 \f
 /*
@@ -147,6 +148,6 @@ WandExport void RelinquishWandId(const size_t id)
 {
   LockSemaphoreInfo(wand_semaphore);
   if (wand_ids != (SplayTreeInfo *) NULL)
-    (void) DeleteNodeByValueFromSplayTree(wand_ids,(const void *) id);
+    (void) DeleteNodeFromSplayTree(wand_ids,(const void *) id);
   UnlockSemaphoreInfo(wand_semaphore);
 }