Address feedback; do not lock in a loop

This commit is contained in:
Lysandros Nikolaou 2024-07-16 17:00:14 +02:00
parent 5999b9b0cc
commit 06767fc325
No known key found for this signature in database
GPG Key ID: 43E92D11D08F5F29

View File

@ -369,12 +369,12 @@ ImagingDestroyArray(Imaging im) {
int y = 0; int y = 0;
if (im->blocks) { if (im->blocks) {
while (im->blocks[y].ptr) {
MUTEX_LOCK(&ImagingDefaultArena.mutex); MUTEX_LOCK(&ImagingDefaultArena.mutex);
while (im->blocks[y].ptr) {
memory_return_block(&ImagingDefaultArena, im->blocks[y]); memory_return_block(&ImagingDefaultArena, im->blocks[y]);
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
y += 1; y += 1;
} }
MUTEX_UNLOCK(&ImagingDefaultArena.mutex);
free(im->blocks); free(im->blocks);
} }
} }