From 93670403847955b4bb6a820d62d1ac2c689fe84d Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 19 Feb 2013 12:42:11 +0000 Subject: [PATCH] --- MagickCore/exception.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/MagickCore/exception.c b/MagickCore/exception.c index fb50942f3..34a01f72c 100644 --- a/MagickCore/exception.c +++ b/MagickCore/exception.c @@ -659,7 +659,7 @@ MagickExport void InheritException(ExceptionInfo *exception, assert(relative->signature == MagickSignature); if (relative->exceptions == (void *) NULL) return; - LockSemaphoreInfo(exception->semaphore); + LockSemaphoreInfo(relative->semaphore); ResetLinkedListIterator((LinkedListInfo *) relative->exceptions); p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) relative->exceptions); @@ -669,7 +669,7 @@ MagickExport void InheritException(ExceptionInfo *exception, p=(const ExceptionInfo *) GetNextValueInLinkedList((LinkedListInfo *) relative->exceptions); } - UnlockSemaphoreInfo(exception->semaphore); + UnlockSemaphoreInfo(relative->semaphore); } /* @@ -915,15 +915,22 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception, assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); + LockSemaphoreInfo(exception->semaphore); p=(ExceptionInfo *) GetLastValueInLinkedList((LinkedListInfo *) exception->exceptions); if ((p != (ExceptionInfo *) NULL) && (p->severity == severity) && (LocaleCompare(exception->reason,reason) == 0) && (LocaleCompare(exception->description,description) == 0)) - return(MagickTrue); + { + UnlockSemaphoreInfo(exception->semaphore); + return(MagickTrue); + } p=(ExceptionInfo *) AcquireMagickMemory(sizeof(*p)); if (p == (ExceptionInfo *) NULL) - ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); + { + UnlockSemaphoreInfo(exception->semaphore); + ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); + } (void) ResetMagickMemory(p,0,sizeof(*p)); p->severity=severity; if (reason != (const char *) NULL) @@ -935,6 +942,7 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception, exception->severity=p->severity; exception->reason=p->reason; exception->description=p->description; + UnlockSemaphoreInfo(exception->semaphore); return(MagickTrue); } @@ -977,10 +985,10 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception, % */ -MagickExport MagickBooleanType ThrowMagickExceptionList(ExceptionInfo *exception, - const char *module,const char *function,const size_t line, - const ExceptionType severity,const char *tag,const char *format, - va_list operands) +MagickExport MagickBooleanType ThrowMagickExceptionList( + ExceptionInfo *exception,const char *module,const char *function, + const size_t line,const ExceptionType severity,const char *tag, + const char *format,va_list operands) { char message[MaxTextExtent], -- 2.40.0