Skip to content

Commit 3bd036e

Browse files
committed
Avoid double-free
1 parent ff9aba9 commit 3bd036e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

SDWebImageAVIFCoder/Classes/SDImageAVIFCoder.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ static CGImageRef CreateImage8(avifImage * avif) {
451451
goto end_alpha_mono;
452452
}
453453
result = CreateImageFromBuffer(avif, &outBuffer);
454+
outBufferData = NULL;
454455
end_alpha_mono:
455456
free(tmpBufferData);
456457
free(monoBufferData);
@@ -462,6 +463,7 @@ static CGImageRef CreateImage8(avifImage * avif) {
462463
goto end_alpha_color;
463464
}
464465
result = CreateImageFromBuffer(avif, &argbBuffer);
466+
outBufferData = NULL;
465467
end_alpha_color:
466468
goto end_alpha;
467469
}
@@ -486,6 +488,7 @@ static CGImageRef CreateImage8(avifImage * avif) {
486488
goto end_no_alpha_mono;
487489
}
488490
result = CreateImageFromBuffer(avif, &outBuffer);
491+
outBufferData = NULL;
489492
end_no_alpha_mono:
490493
free(tmpBufferData);
491494
goto end_no_alpha;
@@ -496,6 +499,7 @@ static CGImageRef CreateImage8(avifImage * avif) {
496499
goto end_no_alpha_color;
497500
}
498501
result = CreateImageFromBuffer(avif, &outBuffer);
502+
outBufferData = NULL;
499503
end_no_alpha_color:
500504
goto end_no_alpha;
501505
}

0 commit comments

Comments
 (0)