Skip to content

Commit

Permalink
fix checking error return value from HeifPixelImage::add_channel() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Dec 16, 2024
1 parent f907f23 commit 7878686
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions libheif/api/libheif/heif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1821,11 +1821,8 @@ struct heif_error heif_image_add_channel(struct heif_image* image,
int width, int height,
heif_channel_datatype datatype, int bit_depth)
{
if (!image->image->add_channel(channel, width, height, datatype, bit_depth, nullptr)) {
struct heif_error err = {heif_error_Memory_allocation_error,
heif_suberror_Unspecified,
"Cannot allocate memory for image plane"};
return err;
if (auto err = image->image->add_channel(channel, width, height, datatype, bit_depth, nullptr)) {
return err.error_struct(image->image.get());
}
else {
return heif_error_success;
Expand Down

0 comments on commit 7878686

Please sign in to comment.