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 6D2E04C5C0 for ; Wed, 25 Jun 2025 15:39:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 2042F68CF11; Wed, 25 Jun 2025 18:38:48 +0300 (EEST) Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 97169687AC8 for ; Wed, 25 Jun 2025 18:38:41 +0300 (EEST) Received: by mail-pf1-f193.google.com with SMTP id d2e1a72fcca58-739b3fe7ce8so154528b3a.0 for ; Wed, 25 Jun 2025 08:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750865920; x=1751470720; 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=7QM21nnWWrI+dE2/FSZwIPg1VnpS/jY69aGRC/VCOio=; b=kjRGvsfEnqmsoQw2FKUboOYhe9D634o3RN7G6q11QaBsx/ET4A796NsZLNbQ1XUB1K Dr9M41FrVU8W9ZSbchtQFuAsBSR58Ckn1CydWfBRcjcCRX9kyFx83E//kNNHDxISXVBb AtndJMhmqMF2xea9H4KCHcroRM5lss13VrRIiJeVu+7Uv3gyyHmBIRD8maH1Af2CAauQ aHtQpvbtgNC425wWa6s5UEX4MaDy3Ac3ywr1tdOjqZuFkYE036TLgMyM4apI2bMC5S4R zCLXohMY3n26YFQpUuVKnZvROqO3U1fHBSsGl5TprSd8nRGEgvsbZTEHmo9FVQjZusde YBuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750865920; x=1751470720; 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=7QM21nnWWrI+dE2/FSZwIPg1VnpS/jY69aGRC/VCOio=; b=ErNi737YRh3UBo6d4eAd7uGEj4vFAtxAV8rIJGRDlMpJqaAgavIB3UKJldWnfqeXay 0EGmkQRKW0v6LIaEIGQ8dN0KRMKe281734Np6E5IseJF+XBXXTgrHny+l5xEfw0fK4Cr EHW4dCbP0/z/6RxmYDnn6hSn/8yFOIHSkEIeDi7aW8EqQPaJ+GqiYPK44GXZCQ7vAluK p/KPKNDGs0buQz8XVDNubi7SRSDFhLF4+w1i00yDTflNwesheIkdKo75KfRiTpjxkjLQ O6RKLmtPy5FLLeNTTnWEU0e5iAlQlfXplGvNP2nIj3kuP1hQ963gCh++t5WclpIfhMU1 K4Dg== X-Gm-Message-State: AOJu0Yx09fMy4m4tj887EBIAEsanp81epOft0iBc2EqtPnMa7k/mQnCb 2rCMD6/spTh9Ow3hFmX95yWaF1YQnstueZF5mSxH0ia997h8TCPic0CBLrmnpU2aT18= X-Gm-Gg: ASbGncvI49iu/Qi7Ac0+OtlQ9DolNDDPBIdkap6YHGH44KdERsl/+sosP10E3eb5OzK M4b25Te6d73NcglmyTMlvbS/hCNZ+RhNF7RAP3z+nQmtNni54dJh6MbunWcEzfASuTYe8AfEpdr iObe+M4CNO+/7LCx/bDCPQHS8PbKYsY04swyl9BM8tQAKLjESa5Q0ZIXkNO/MpO45qCqCSvIMYC TRcbFpQlzmS1LoujZormCZdHx7EYpKwpEG+Zy6kIlWUxzNIwd0d6AC+WSjEYxptql6vC2f1leld fCD+lsvb4Pirsx8hG94F/yw2y96GjW5eI+7MKMaN80td1hS0UXA4olSUzCohrgFIJJLk X-Google-Smtp-Source: AGHT+IEhcid7yVtqK4nObesu1/Z2l2Ka6NLvoI8krv2K3vEw1lzUmEC1heKZfrEhFJuYb4id0bi8mA== X-Received: by 2002:a05:6a20:c901:b0:206:a9bd:a3a3 with SMTP id adf61e73a8af0-2207f25e144mr6517132637.24.1750865919605; Wed, 25 Jun 2025 08:38:39 -0700 (PDT) Received: from r760 ([188.253.126.207]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-749c88723e9sm4690493b3a.153.2025.06.25.08.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jun 2025 08:38:39 -0700 (PDT) From: Lidong Yan X-Google-Original-From: Lidong Yan <502024330056@smail.nju.edu.cn> To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 Jun 2025 23:38:30 +0800 Message-ID: <20250625153831.2268905-2-502024330056@smail.nju.edu.cn> X-Mailer: git-send-email 2.50.0.108.g6ae0c543ae In-Reply-To: <20250625153831.2268905-1-502024330056@smail.nju.edu.cn> References: <20250625153831.2268905-1-502024330056@smail.nju.edu.cn> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] 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 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 config_input(), fir_to_phase() allocates memory in h[longer]. But if av_calloc() to s->coeffs failed, memory in h[longer] would leak. Also noticed that after fir_to_phase() there are three return point, two of them didn't free h[longer]. However, the first return points means fir_to_phase() failed, which in turn means that memory in h[longer] has not been allocated yet. To fix this leak, add av_free(h[longer]) in av_calloc() failed branch would be enough. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> --- libavfilter/asrc_sinc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/asrc_sinc.c b/libavfilter/asrc_sinc.c index 6ff3303316..198c322665 100644 --- a/libavfilter/asrc_sinc.c +++ b/libavfilter/asrc_sinc.c @@ -370,8 +370,10 @@ static int config_output(AVFilterLink *outlink) s->n = 1 << (av_log2(n) + 1); s->rdft_len = 1 << av_log2(n); s->coeffs = av_calloc(s->n, sizeof(*s->coeffs)); - if (!s->coeffs) + if (!s->coeffs) { + av_free(h[longer]); return AVERROR(ENOMEM); + } for (i = 0; i < n; i++) s->coeffs[i] = h[longer][i]; -- 2.50.0.108.g6ae0c543ae _______________________________________________ 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".