From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 63B2B49551 for ; Sat, 13 Apr 2024 03:57:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7640F68D2E6; Sat, 13 Apr 2024 06:57:20 +0300 (EEST) Received: from m15.mail.163.com (m15.mail.163.com [45.254.50.219]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B723468D292 for ; Sat, 13 Apr 2024 06:57:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=qt1u2 1C9c98VW6C0/9bTlCoTORl0kNG9sEbaCngexsQ=; b=K9d+iWWgA6NLnwGou/Phl pNDA9aTTmlxsYopdodN8LZBJLobCo71nqfuvEIYp1dlP3DSwy3Rt3vtg9ojteQ8t sxUTz7aURjDjOVCANVdavTkUcVx4ITvTTQX3eef25wvsbrS3C6/YQB8QfufLOAm0 Mg9n0/VtGE/4qcEeQuxGJQ= Received: from localhost.localdomain (unknown [111.198.54.11]) by gzga-smtp-mta-g0-5 (Coremail) with SMTP id _____wD3v2WOAhpmOHPuAw--.60471S2; Sat, 13 Apr 2024 11:57:03 +0800 (CST) From: LuMingYin To: ffmpeg-devel@ffmpeg.org Date: Sat, 13 Apr 2024 11:57:00 +0800 Message-Id: <20240413035700.1961642-1-lumingyindetect@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: _____wD3v2WOAhpmOHPuAw--.60471S2 X-Coremail-Antispam: 1Uf129KBjvPXoW8Zw4kCr4UAFy3tF4UJF1Dp5X_Gr13JoWUZF 45Ka48Gr92kFy3tF9rGF98Zw1fXFy7XF18CayUAF48A3WUKw1fX3WUZr4DCFs8Kry8A3y0 q39rJ3Z8tan7n29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3AaLa J3UbIYCTnIWIevJa73UjIFyTuYvj4RJgAzUUUUU X-Originating-IP: [111.198.54.11] X-CM-SenderInfo: poxpx0hj1l0vphwhu3i6rwjhhfrp/xtbBLxS-92XAkltU+QAAsy Subject: [FFmpeg-devel] [PATCH] libavfilter/vf_curves: fix a memory leak in libavfilter/vf_curves.c 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: lumingyindetect@163.com 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: The pointer variable 'point', which is defined and dynamically allocated memory within the while loop of the 'parse_points_str' function, is not released on error paths. Signed-off-by: LuMingYin --- libavfilter/vf_curves.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c index 3e4a42bab3..97f284db22 100644 --- a/libavfilter/vf_curves.c +++ b/libavfilter/vf_curves.c @@ -182,20 +182,22 @@ static int parse_points_str(AVFilterContext *ctx, struct keypoint **points, cons if (point->x < 0 || point->x > 1 || point->y < 0 || point->y > 1) { av_log(ctx, AV_LOG_ERROR, "Invalid key point coordinates (%f;%f), " "x and y must be in the [0;1] range.\n", point->x, point->y); + av_free(point); return AVERROR(EINVAL); } - if (!*points) - *points = point; if (last) { if ((int)(last->x * scale) >= (int)(point->x * scale)) { av_log(ctx, AV_LOG_ERROR, "Key point coordinates (%f;%f) " "and (%f;%f) are too close from each other or not " "strictly increasing on the x-axis\n", last->x, last->y, point->x, point->y); + av_free(point); return AVERROR(EINVAL); } last->next = point; } + if (!*points) + *points = point; last = point; } -- 2.25.1 _______________________________________________ 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".