Skip to content

Commit

Permalink
Check memory allocations.
Browse files Browse the repository at this point in the history
  • Loading branch information
maryla-uc committed Nov 29, 2023
1 parent 5b83d9f commit ae06afc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/avifgainmaputil/convert_command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ avifResult ConvertCommand::Run() {
depth = image->gainMap->metadata.alternateHdrHeadroomN == 0 ? 8 : 10;
}
ImagePtr new_base(avifImageCreateEmpty());
if (new_base == nullptr) {
return AVIF_RESULT_OUT_OF_MEMORY;
}
const avifResult result =
ChangeBase(*image, depth, image->yuvFormat, new_base.get());
if (result != AVIF_RESULT_OK) {
Expand Down
3 changes: 3 additions & 0 deletions apps/avifgainmaputil/swapbase_command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ avifResult SwapBaseCommand::Run() {
}

ImagePtr new_base(avifImageCreateEmpty());
if (new_base == nullptr) {
return AVIF_RESULT_OUT_OF_MEMORY;
}
result = ChangeBase(*image, depth, pixel_format, new_base.get());
if (result != AVIF_RESULT_OK) {
return result;
Expand Down

0 comments on commit ae06afc

Please sign in to comment.