[FFmpeg-devel] [PATCH] avdevice/gdigrab: Memory leak if BitBlt return false.
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Thu Oct 22 16:52:44 EEST 2020
dont.buck at gmail.com:
> From: walle <dont.buck at gmail.com>
>
> lock screen or other permission notification in win7 or
> higher windows version would case BitBlt return false,
> and gdigrab_read_packet will return AVERROR(EIO) and do nothing to
> allocated packet data, then memory leak happend. It's necessary to
> release packet data before return from gdigrab_read_packet.
> ---
> libavdevice/gdigrab.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c
> index f4444406fa..b69494c98d 100644
> --- a/libavdevice/gdigrab.c
> +++ b/libavdevice/gdigrab.c
> @@ -576,6 +576,7 @@ static int gdigrab_read_packet(AVFormatContext *s1, AVPacket *pkt)
> clip_rect.bottom - clip_rect.top,
> source_hdc,
> clip_rect.left, clip_rect.top, SRCCOPY | CAPTUREBLT)) {
> + av_packet_unref(pkt);
> WIN32_API_ERROR("Failed to capture image");
> return AVERROR(EIO);
> }
>
What version did you use when encountering this leak? This leak should
have been fixed in bae8844e35147f92e612a9e0b44e939a293e5bc9.
- Andreas
More information about the ffmpeg-devel
mailing list