X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=image_input.cpp;h=090b6db6cf1ba700f7e3b2e1c8bf06e0c010c699;hb=06bf43108bde2d00776281fa916f42cdecd22ef1;hp=b4fc65749215e740b6c10c718b4a63e9d02f2410;hpb=46a29f577f39bf2000553e53683b34b7f50f8dbf;p=nageru diff --git a/image_input.cpp b/image_input.cpp index b4fc657..090b6db 100644 --- a/image_input.cpp +++ b/image_input.cpp @@ -63,6 +63,7 @@ ImageInput::ImageInput(const std::string &filename) exit(1); } if (pkt.stream_index != stream_index) { + av_free_packet(&pkt); continue; } @@ -70,6 +71,7 @@ ImageInput::ImageInput(const std::string &filename) fprintf(stderr, "%s: Cannot decode frame\n", filename.c_str()); exit(1); } + av_free_packet(&pkt); } while (!frame_finished); // TODO: Scale down if needed! @@ -89,4 +91,9 @@ ImageInput::ImageInput(const std::string &filename) image_data.reset(new uint8_t[len]); av_image_copy_to_buffer(image_data.get(), len, pic.data, pic.linesize, PIX_FMT_RGBA, frame->width, frame->height, 1); set_pixel_data(image_data.get()); + + avpicture_free(&pic); + av_frame_free(&frame); + avcodec_close(codec_ctx); + avformat_close_input(&format_ctx); }