From patchwork Thu May 22 12:55:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 23426 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id F28AEC331D for ; Thu, 22 May 2025 12:55:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6184768D9A; Thu, 22 May 2025 14:55:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="pP0Eg3mK"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B87EB68D9C for ; Thu, 22 May 2025 14:55:30 +0200 (CEST) Received: from pendragon.ideasonboard.com (179.218-130-109.adsl-dyn.isp.belgacom.be [109.130.218.179]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9D9A6605; Thu, 22 May 2025 14:55:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1747918508; bh=9CBxB4AKcCtw8eeFaSd3pROhHuvoNSzZesiLoYlauvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pP0Eg3mKSkW6ZDo9j2j7w10vNIvX2ktJN3pdNvGYFC4uoDDYxzbcla/oeFWKYvQcN PX4Q8VjdxmP516QNMu5PTL7zgHfNyQe/tVSc7rK7l0TKARrzIyy826WoG53sS9MHlQ LTrZQazYw4yKkxyJSfTb90l2iST3zwpTXt80Z68o= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Hou Qi , Nicolas Dufresne Subject: [PATCH 3/4] gstreamer: Fix leak of GstQuery in error path Date: Thu, 22 May 2025 14:55:20 +0200 Message-ID: <20250522125521.6465-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250522125521.6465-1-laurent.pinchart@ideasonboard.com> References: <20250522125521.6465-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The gst_libcamera_create_video_pool() function leaks a GstQuery instance in an error path. Fix it with g_autoptr(). Signed-off-by: Laurent Pinchart Reviewed-by: Nicolas Dufresne --- src/gstreamer/gstlibcamerasrc.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 71f5700d9de7..380f8368af8b 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -526,7 +526,7 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstVideoInfo *info, GstPad *srcpad, GstCaps *caps) { - GstQuery *query = NULL; + g_autoptr(GstQuery) query = NULL; const gboolean need_pool = true; gboolean has_video_meta = false; GstBufferPool *video_pool = NULL; @@ -571,7 +571,6 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, } } - gst_query_unref(query); return { video_pool, 0 }; }