Skip to content

Commit

Permalink
fix memory leak (strukturag#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk authored and 1div0 committed May 14, 2021
1 parent ea0e3f0 commit 8a76ebc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libheif/heif_colorconversion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2458,13 +2458,13 @@ Op_to_sdr_planes::convert_colorspace(const std::shared_ptr<const HeifPixelImage>
heif_channel_B,
heif_channel_Alpha}) {
if (input->has_channel(channel)) {
int width = input->get_width(channel);
int height = input->get_height(channel);
outimg->add_plane(channel, width, height, 8);

int input_bits = input->get_bits_per_pixel(channel);

if (input_bits>8) {
int width = input->get_width(channel);
int height = input->get_height(channel);
outimg->add_plane(channel, width, height, 8);

int shift = input_bits - 8;

const uint16_t* p_in;
Expand Down
2 changes: 2 additions & 0 deletions libheif/heif_image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ void HeifPixelImage::copy_new_plane_from(const std::shared_ptr<const HeifPixelIm
int width = src_image->get_width(src_channel);
int height = src_image->get_height(src_channel);

assert(!has_channel(dst_channel));

add_plane(dst_channel, width, height, src_image->get_bits_per_pixel(src_channel));

uint8_t* dst;
Expand Down

0 comments on commit 8a76ebc

Please sign in to comment.