diff --git a/README.md b/README.md index 2bdf572..cd5eea2 100644 --- a/README.md +++ b/README.md @@ -475,7 +475,7 @@ sudo dnf install pandoc # If you want to recreate the man page ```bash sudo apt install cmake git g++ pkg-config -sudo apt install libgraphicsmagick++-dev libturbojpeg-dev libexif-dev libswscale-dev libdeflate # needed libs +sudo apt install libgraphicsmagick++-dev libturbojpeg-dev libexif-dev libswscale-dev libdeflate-dev # needed libs # If you want to include video decoding, also install these additional libraries sudo apt install libavcodec-dev libavformat-dev diff --git a/src/timg-png.cc b/src/timg-png.cc index e2d6ce4..aa594a2 100644 --- a/src/timg-png.cc +++ b/src/timg-png.cc @@ -115,7 +115,7 @@ static size_t EncodePNGInternal(const Framebuffer &fb, int compression_level, block.StartNextBlock("IDAT"); const int compress_avail = size - (block.writePos() - (uint8_t *)buffer); - libdeflate_compressor *compressor = + libdeflate_compressor *const compressor = libdeflate_alloc_compressor(compression_level); const int bytes_per_pixel = with_alpha ? 4 : 3; const rgba_t *current_line = fb.begin(); @@ -137,7 +137,9 @@ static size_t EncodePNGInternal(const Framebuffer &fb, int compression_level, compressor, compress_buffer, out - compress_buffer, // block.writePos(), compress_avail); block.updateWritten(written_size); + delete[] compress_buffer; + libdeflate_free_compressor(compressor); block.StartNextBlock("IEND"); return block.Finalize() - (uint8_t *)buffer;