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 B1FB24D025 for ; Sun, 29 Jun 2025 22:29:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id EC10868DB97; Mon, 30 Jun 2025 01:29:39 +0300 (EEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 2137D68DB45 for ; Mon, 30 Jun 2025 01:29:33 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 29F67431BA for ; Sun, 29 Jun 2025 22:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751236172; 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=ZmWsoMSbobMXeRHgJP4j1IwlOCHb6SOL8MNjKICMZWI=; b=XT9Il/WYj/nA++KWaYOpgwjBdbVpuUFiRuU1mbrd/E7UDhheT1P1NhWkD8JO3nVohUt5Kc XxH35AeHP3J3g3j8+OMUww9lZozXxzbjLPz4G/dAW8xkvYWP19YCP714fxxIzGT9DKgEeq o5LbOV7HkNzMDL4M4M9OpThLPXqbkjAdJPMVeZi3Eo6fkDDa5kkOx+GiwsxoIFPF2f9TH2 upkLWncuJxQ0k5T3gM10zt0FTvRZqlwqCBJrvGzveCFPNzHOg5gUsRv13vlTeP5al58WUN O5ofRqv3R+XfNR9YdPYZiDT4SaAxzz2OrhRJIY7goKB19gZLKBGrX4G23DJLyA== Date: Mon, 30 Jun 2025 00:29:31 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250629222931.GV29660@pb2> References: <20250628070836.1434761-1-502024330056@smail.nju.edu.cn> MIME-Version: 1.0 In-Reply-To: <20250628070836.1434761-1-502024330056@smail.nju.edu.cn> X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddutddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdludehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepieegkedtjeduffejhfetgeejtdegteetgfegtdfhjefgvefhteegkeejtddvhfevnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v3] avfilter/asrc_sinc: fix leak in config_input() 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="===============6747559612093807119==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============6747559612093807119== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="eUC25620EF+8aQwD" Content-Disposition: inline --eUC25620EF+8aQwD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 28, 2025 at 03:08:36PM +0800, Lidong Yan wrote: > In config_input(), fir_to_phase() allocates memory in h[longer], which > would leak if av_calloc() to s->coeffs failed. lpf() allocates memory > in h[0] and h[1], which would leak if fir_to_phase() failed. To fix > this leak, add av_free(h[longer]) in as cleanup code, and replace > return AVERROR* with goto cleanup to prevent from leaks. >=20 > Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> >=20 > -----BEGIN PGP PUBLIC KEY BLOCK----- >=20 > mDMEaEpkmRYJKwYBBAHaRw8BAQdAGwGqH/Dwod+i6kR0/Rhn5GanJ7wK8mM9tWP/ > W2qu8Ti0HTUwMjAyNDMzMDA1NkBzbWFpbC5uanUuZWR1LmNuiJkEExYKAEEWIQQC > zskBcOehk1y8GoKZR31bPD+6owUCaEpkmQIbAwUJBaOagAULCQgHAgIiAgYVCgkI > CwIEFgIDAQIeBwIXgAAKCRCZR31bPD+6o8wHAQCLomsA4XfTd8IdG983gGULUJe/ > 0432buy4nX7AsAc87QEA+/QIsWTR6XLJaLa1sLSQCsZkb86U3c17JzG9oivL8gW4 > OARoSmSZEgorBgEEAZdVAQUBAQdAfYrEAWd+6bOXkKvHpFmMvKzxAtlhm6ZQKdAq > +MlJ7wQDAQgHiHgEGBYKACAWIQQCzskBcOehk1y8GoKZR31bPD+6owUCaEpkmQIb > DAAKCRCZR31bPD+6ozWxAQC9OFisWrP/hHXUfj8AnC39r5pf5fEBz7lHvFgWNk2b > XwD7Bl6kvIIW7ReqtgXvcl7u78vEo+e9YeTGTlmAogjpeQk=3D > =3DrP+W > -----END PGP PUBLIC KEY BLOCK----- >=20 > --- > libavfilter/asrc_sinc.c | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) >=20 > diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c > index 6ff3303316..63cb04d444 100644 > --- a/libavfilter/asrc_sinc.c > +++ b/libavfilter/asrc_sinc.c > @@ -329,7 +329,7 @@ static int config_output(AVFilterLink *outlink) > SincContext *s =3D ctx->priv; > float Fn =3D s->sample_rate * .5f; > float *h[2]; > - int i, n, post_peak, longer; > + int i, n, post_peak, longer, ret; > =20 > outlink->sample_rate =3D s->sample_rate; > s->pts =3D 0; > @@ -360,9 +360,9 @@ static int config_output(AVFilterLink *outlink) > } > =20 > if (s->phase !=3D 50.f) { > - int ret =3D fir_to_phase(s, &h[longer], &n, &post_peak, s->phase= ); > + ret =3D fir_to_phase(s, &h[longer], &n, &post_peak, s->phase); > if (ret < 0) > - return ret; > + goto cleanup; [...] > +cleanup: > + av_free(h[longer]); > return 0; this is not the correct return code thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. U= ser questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML. --eUC25620EF+8aQwD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaGG+SAAKCRBhHseHBAsP q3OtAJwIqnm6M0+A/EFCRGmpevyU9+jqrQCfemKwi4/8VcQlhcwD55H1N1RDwDQ= =AelS -----END PGP SIGNATURE----- --eUC25620EF+8aQwD-- --===============6747559612093807119== 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". --===============6747559612093807119==--