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 1622540025 for ; Tue, 17 Jun 2025 14:15:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id D207A68D2D5; Tue, 17 Jun 2025 17:14:40 +0300 (EEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 6BB8668CFDC for ; Tue, 17 Jun 2025 17:14:38 +0300 (EEST) Received: by mail-pf1-f194.google.com with SMTP id d2e1a72fcca58-7424ccbef4eso5079401b3a.2 for ; Tue, 17 Jun 2025 07:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750169676; x=1750774476; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UzjSDvM+fWnGFLYCEuK2VilsgtSQABp+D6ft1HP2lvg=; b=asc8cNoFdcPntPjsOF62QLf3i5yWAGUVUreTuqUHzEV2L0ZOEHWALEyVcdqq0NKYij kvwZb9oG4VNcE8Ec4O3Xb9KBcJjVjJsJKdEpAx5thTXZVU2MPc6ymvahWc1F/7bFnvp8 ebCFwI7rQ8pFxUE7fMmOOR5AK7YAffZGdgHquCLX+n1dScWMwu3bDZ6RCrAwx/NdMnYf lPt3as+iJtu5gSPrUVxrfWV/6EGbYKWWKjfkeXaVm9+3EYGmVJasMhGl9DzOrJ5NATH3 mPYffHJYn/Aihf14YzWm15dgGh9wn5RwyNrIDxGgAlqnQGIxgiUvJaG5FHWU3bYMRz7O wejQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750169676; x=1750774476; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UzjSDvM+fWnGFLYCEuK2VilsgtSQABp+D6ft1HP2lvg=; b=JD9hFUkCpVqN1TxhVI5G0MzTVmut1lQDfHzIsfmkPaV60q/LFhtSV5DGMs1wUcWEW/ SeiCAUI0mRECBI4JgiNCGw5ilrcoscrjrpYENop95qIfsMAHWSf27v16bW7RX/G02mYr wB5e7EG5LaWjZFlb9JJlqj2pGyeiFLzP1s49aKsfontI+qebWyTp2J4lNa/JrxATVzCD zR83VglQVGcqOZuwyWkuBdUR0sRV7PgL9D5033kFNKeP656C87KyY7aKidDaxQf8XBLs sNwf3kq38WUKUJg1OMdqMH6XzY6/LDvTQ6KjpUJzhO+ic+RDF33NdctshFkj4JbVwc3j CNQA== X-Gm-Message-State: AOJu0YxuTpFnxABJpSNIlO1tOAc5PA5F96IfiSQqXKQ2zhcA0I+RCHRA 6/Pj0j80dEzZ/IHeK33N+ipMytRe4qFMlQTiruFJ0vFFF/GEAWboXC4fd47jilkaPTft8w== X-Gm-Gg: ASbGnct8aN4W0HfbFowe4bE/OAzR2jQuzTPvuqRlWttdeZsZPheaxaKDSFNeYKE+0+P hvWhDG6s0bHeleLn2SM7ayRbdPCcOp5Al55tsxllSgOx8rFUEbY7e7UNBM9n4OEwUh65PgFYXho 5PVIjd7p5Q1IGjPGmrSjZYGzioXBmZDy2kgmj8lpG0GTEr+XhRXujHi5Z7iPdIo0lteIDLZi6Sr wHTG6y2frJ9H6xJ+ZyirgzjUjfWDW5q/JqZ8x/Dzu0sWbJuOMZ5koTprFQmprfpazjWdrJ5s/E/ jnAis5laqsMo7m8ZUmXuIYvLxntrQCZxsfUvfBE4dRDR5GV5j3ytzZhTK+2AHYOryD1U X-Google-Smtp-Source: AGHT+IG6QfyRxkubxPIZV8vTtiKVx0CjgQsjvO5KkVc9RXkWzxxQexlVVRKtJCxgPd+KkwEmCX6DZg== X-Received: by 2002:a05:6a00:2d8e:b0:740:6f69:f52a with SMTP id d2e1a72fcca58-7489cd5c0b9mr17804398b3a.0.1750169676330; Tue, 17 Jun 2025 07:14:36 -0700 (PDT) Received: from r760 ([188.253.126.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-748900b2e30sm8838413b3a.128.2025.06.17.07.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jun 2025 07:14:36 -0700 (PDT) From: Lidong Yan X-Google-Original-From: Lidong Yan <502024330056@smail.nju.edu.cn> To: ffmpeg-devel@ffmpeg.org Date: Tue, 17 Jun 2025 22:14:16 +0800 Message-ID: <20250617141416.950239-5-502024330056@smail.nju.edu.cn> X-Mailer: git-send-email 2.50.0-rc1 In-Reply-To: <20250617141416.950239-1-502024330056@smail.nju.edu.cn> References: <20250617141416.950239-1-502024330056@smail.nju.edu.cn> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] 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 Cc: Lidong Yan <502024330056@smail.nju.edu.cn> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: In sap_write_header(), ff_format_set_url() assign new allocated new_url to contexts[i]->url but forgot to free it later. Add two loops to free contexts[i]->url before av_free(context). Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> --- libavformat/sapenc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c index 87a834a8d8..3ba7f16022 100644 --- a/libavformat/sapenc.c +++ b/libavformat/sapenc.c @@ -233,6 +233,9 @@ static int sap_write_header(AVFormatContext *s) ret = AVERROR_INVALIDDATA; goto fail; } + for (i = 0; i < s->nb_streams; i++) + if (contexts[i]) + av_free(contexts[i]->url); av_freep(&contexts); av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", &sap->ann[pos]); pos += strlen(&sap->ann[pos]); @@ -247,6 +250,9 @@ static int sap_write_header(AVFormatContext *s) return 0; fail: + for (i = 0; i < s->nb_streams; i++) + if (contexts[i]) + av_free(contexts[i]->url); av_free(contexts); sap_write_close(s); return ret; -- 2.50.0-rc1 _______________________________________________ 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".