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 511304CEDE for ; Sat, 28 Jun 2025 20:18:29 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 1265D68E516; Sat, 28 Jun 2025 23:18:25 +0300 (EEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id A899368E4F2 for ; Sat, 28 Jun 2025 23:18:17 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E9A3A1FD32 for ; Sat, 28 Jun 2025 20:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1751141897; 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=iyQY4+Bs0bQlPvpqOVyt80Zdx/Lxs90AdMdd3NA2p+U=; b=nZk7lc3lCjUg0KZboXVbRohBUcvJTMqWbOzYPto5heJ33yQX5xSZ9tUxSrSHUSAN0iEpXL Z2VX9cPGem7Ph5CdNWI02xipLfaGq62fNkW0XuOeS/ydv4SHHDGJPMjhfqcR+JKu7I7Lmx JO5EcSuEdfKpi72/3EYTlc850NJCKRlErvaAKYWsixoZYGXHG/2sJcSQkt13nesAd9OBWC L/UK+xWuX9NCBJylIxZAKBV1zTxiJfzoLkmAzvCcq3403A/SNJ29vfCq8v5HiGK4JyHQ8o /15xdMVDNt9Z5MD9NVeyNHHcGfe/NdYqMnyedX7hiV/co15sHt7xDEJhbRHv4Q== Date: Sat, 28 Jun 2025 22:18:15 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250628201815.GP29660@pb2> References: <20250625153831.2268905-1-502024330056@smail.nju.edu.cn> <20250625153831.2268905-3-502024330056@smail.nju.edu.cn> MIME-Version: 1.0 In-Reply-To: <20250625153831.2268905-3-502024330056@smail.nju.edu.cn> X-GND-State: clean X-GND-Score: -85 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdeikeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdduhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpeeigeektdejudffjefhteegjedtgeettefggedthfejgfevhfetgeekjedtvdfhveenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH 2/2] avformat/sapenc: fix leak in sap_write_header() 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="===============2023799028832206220==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2023799028832206220== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ejtsa7UHaae3zfC8" Content-Disposition: inline --ejtsa7UHaae3zfC8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 25, 2025 at 11:38:31PM +0800, Lidong Yan wrote: > In sap_write_header(), ff_format_set_url() assign new allocated new_url > to contexts[i]->url but forgot to free it later. Add for loop to free > contexts[i]->url before av_free(context). >=20 > To prevent from writing free-for-loop in every return point, replace > `return 0` with `ret =3D 0` so normal execution can fall through cleanup > code. Since normal code execution now go through code after fail label, > replace fail label with cleanup label. >=20 > Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> > --- > libavformat/sapenc.c | 35 +++++++++++++++++++---------------- > 1 file changed, 19 insertions(+), 16 deletions(-) >=20 > diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c > index 87a834a8d8..810ba4adf6 100644 > --- a/libavformat/sapenc.c > +++ b/libavformat/sapenc.c > @@ -113,7 +113,7 @@ static int sap_write_header(AVFormatContext *s) > if (getaddrinfo(host, NULL, &hints, &ai)) { > av_log(s, AV_LOG_ERROR, "Unable to resolve %s\n", host); > ret =3D AVERROR(EIO); > - goto fail; > + goto cleanup; please do the rename in a seperate patch so there are 2 patches, this makes the changes clearer thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates --ejtsa7UHaae3zfC8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaGBOBAAKCRBhHseHBAsP q446AJ0WtpFpM7Q/1Hk3Oa2pQnTGpyD+hQCgkNgrygDUO6OM4/hoZuAThVcO2tI= =ApcE -----END PGP SIGNATURE----- --ejtsa7UHaae3zfC8-- --===============2023799028832206220== 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". --===============2023799028832206220==--