From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 1AA464CF1A for ; Mon, 30 Jun 2025 01:20:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id E989B687D1D; Mon, 30 Jun 2025 04:20:40 +0300 (EEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 816FD68DE7F for ; Mon, 30 Jun 2025 04:20:39 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E974844212 for ; Mon, 30 Jun 2025 01:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751246438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=T+y/CAu7/ZnWRqnQzDzMNesFEYEuIPUpqsFcSfj/89E=; b=OIN9+GjkgijmUBNSHGjGr87P5Y9ExvyrVyDoMJXhvMNwXFnd4qrHgV0J8L99QyB+DfrLEP +4sJL+88jYCy03drHt11LlxgQjC19F4Tcd1NEJYpt8ZzK0/DLBXqLs/LrYjP71obz4M6S8 FrNkz4KaQM7BMvZhDudGjaiggrCoJ8SW3qGq8+2mwRO/wOCpiEp6J/cmr8O1yNUCeojR7g xTXpr/V1SPvDrkmkVNAqcFbD65pCC4sr/umeiAIxd+1iF8mNtE1Yb43GqkGF/iYdYUTzqY lgSF8XJQtS0koqMK690sDUWMpQV7BzgOGU3Ic7ApwXVWvWic2cxUz0o5CNk9Iw== Date: Mon, 30 Jun 2025 03:20:36 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250630012036.GB29660@pb2> References: <20250629064526.2992143-1-502024330056@smail.nju.edu.cn> <20250629064526.2992143-2-502024330056@smail.nju.edu.cn> MIME-Version: 1.0 In-Reply-To: <20250629064526.2992143-2-502024330056@smail.nju.edu.cn> X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddutdefiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepieegkedtjeduffejhfetgeejtdegteetgfegtdfhjefgvefhteegkeejtddvhfevnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 1/5] avcodec/utvideodec: fix leaks in decode_plane() and decode_plane10() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============6502471192890716626==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6502471192890716626== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="W5KCvpNyLl+sMDQV" Content-Disposition: inline --W5KCvpNyLl+sMDQV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 29, 2025 at 02:45:22PM +0800, Lidong Yan wrote: > In decode_plane() and decode_plane10(), both of these two functions use > build_buff() which allocates memory in vlc and multi. And both of them > forget to release vlc and multi when build_buff report a symbol to fill > slices with. Add cleanup label and goto cleanup first before return 0. >=20 > Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> > --- > libavcodec/utvideodec.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c > index 4c0fa2ca67..f15d623462 100644 > --- a/libavcodec/utvideodec.c > +++ b/libavcodec/utvideodec.c > @@ -179,7 +179,7 @@ static int decode_plane10(UtvideoContext *c, int plan= e_no, > dest +=3D stride; > } > } > - return 0; > + goto cleanup; > } > =20 > send =3D 0; > @@ -216,6 +216,7 @@ static int decode_plane10(UtvideoContext *c, int plan= e_no, > "%d bits left after decoding slice\n", get_bits_left(= &gb)); > } > =20 > +cleanup: > ff_vlc_free(&vlc); > ff_vlc_free_multi(&multi); > =20 > @@ -322,7 +323,7 @@ static int decode_plane(UtvideoContext *c, int plane_= no, > dest +=3D stride; > } > } > - return 0; > + goto cleanup; > } > =20 > src +=3D 256; > @@ -361,6 +362,7 @@ static int decode_plane(UtvideoContext *c, int plane_= no, > "%d bits left after decoding slice\n", get_bits_left(= &gb)); > } > =20 > +cleanup: > ff_vlc_free(&vlc); > ff_vlc_free_multi(&multi); This is not correct build_huff() does not set these when fsym >=3D 0 your patch runs free() on random uninitialized variables before submitting memleak fixes, please verify that 1. there is actually a leak 2. your patch does not introduce a new anomaly thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri --W5KCvpNyLl+sMDQV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaGHmWgAKCRBhHseHBAsP q0fqAJ0X2wptzzQxqjCk44ITU6GJHG9RaACfcxp7O9TN+nB8Kar2d/RVo/SoUiw= =8Iwo -----END PGP SIGNATURE----- --W5KCvpNyLl+sMDQV-- --===============6502471192890716626== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============6502471192890716626==--