diff --git a/MagickCore/resource.c b/MagickCore/resource.c
index 4601ac5..278d7e9 100644
--- a/MagickCore/resource.c
+++ b/MagickCore/resource.c
@@ -1094,6 +1094,7 @@
   if (resource_semaphore == (SemaphoreInfo *) NULL)
     AcquireSemaphoreInfo(&resource_semaphore);
   LockSemaphoreInfo(resource_semaphore);
+  value=(char *) NULL;
   switch (type)
   {
     case AreaResource:
@@ -1158,6 +1159,8 @@
     default:
       break;
   }
+  if (value != (char *) NULL)
+    value=DestroyString(value);
   UnlockSemaphoreInfo(resource_semaphore);
   return(MagickTrue);
 }