Skip to content

Commit

Permalink
revert memory leak patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Nov 24, 2021
1 parent 2b6531d commit 34266d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
3 changes: 0 additions & 3 deletions MagickCore/cache-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ typedef struct _NexusInfo

struct _NexusInfo
*virtual_nexus;

SemaphoreInfo
*semaphore;
} NexusInfo;

typedef struct _CacheInfo
Expand Down
26 changes: 7 additions & 19 deletions MagickCore/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ MagickPrivate NexusInfo **AcquirePixelCacheNexus(const size_t number_threads)
nexus_info[i]=(*nexus_info+i);
if (i < (ssize_t) number_threads)
nexus_info[i]->virtual_nexus=(*nexus_info+number_threads+i);
nexus_info[i]->semaphore=AcquireSemaphoreInfo();
nexus_info[i]->signature=MagickCoreSignature;
}
return(nexus_info);
Expand Down Expand Up @@ -1128,8 +1127,6 @@ MagickPrivate NexusInfo **DestroyPixelCacheNexus(NexusInfo **nexus_info,
{
if (nexus_info[i]->cache != (Quantum *) NULL)
RelinquishCacheNexusPixels(nexus_info[i]);
if (nexus_info[i]->semaphore != (SemaphoreInfo *) NULL)
RelinquishSemaphoreInfo(&nexus_info[i]->semaphore);
nexus_info[i]->signature=(~MagickCoreSignature);
}
*nexus_info=(NexusInfo *) RelinquishMagickMemory(*nexus_info);
Expand Down Expand Up @@ -5096,23 +5093,14 @@ static Quantum *SetPixelCacheNexusPixels(
if (cache_info->metacontent_extent != 0)
length+=number_pixels*cache_info->metacontent_extent;
status=MagickTrue;
if ((nexus_info->cache == (Quantum *) NULL) || (nexus_info->length < length))
{
/*
Allocate or grow nexus pixel cache.
*/
LockSemaphoreInfo(nexus_info->semaphore);
if (nexus_info->cache == (Quantum *) NULL)
if (nexus_info->cache == (Quantum *) NULL)
status=AcquireCacheNexusPixels(cache_info,length,nexus_info,exception);
else
if (nexus_info->length < length)
{
RelinquishCacheNexusPixels(nexus_info);
status=AcquireCacheNexusPixels(cache_info,length,nexus_info,exception);
else
if (nexus_info->length < length)
{
RelinquishCacheNexusPixels(nexus_info);
status=AcquireCacheNexusPixels(cache_info,length,nexus_info,
exception);
}
UnlockSemaphoreInfo(nexus_info->semaphore);
}
}
if (status == MagickFalse)
return((Quantum *) NULL);
nexus_info->pixels=nexus_info->cache;
Expand Down

0 comments on commit 34266d6

Please sign in to comment.