Skip to content

Commit 2b14784

Browse files
committed
avifArrayPush: Fix oldPtr leak if avifAlloc fails
1 parent 3b4ff0f commit 2b14784

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/utils.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ void * avifArrayPush(void * arrayStruct)
113113
size_t oldByteCount = (size_t)arr->elementSize * arr->capacity;
114114
arr->ptr = (uint8_t *)avifAlloc(oldByteCount * 2);
115115
if (arr->ptr == NULL) {
116+
arr->ptr = oldPtr;
116117
return NULL;
117118
}
118119
memset(arr->ptr + oldByteCount, 0, oldByteCount);

0 commit comments

Comments
 (0)