Show a patch.

GET /api/patches/23466/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 23466,
    "url": "https://patchwork.libcamera.org/api/patches/23466/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23466/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20250604130741.9228-6-laurent.pinchart@ideasonboard.com>",
    "date": "2025-06-04T13:07:39",
    "name": "[v2,5/7] gstreamer: Fix leak of GstQuery and GstBufferPool in error path",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "4231145521a03e2886b74f630bdc6a9334eec37d",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23466/mbox/",
    "series": [
        {
            "id": 5204,
            "url": "https://patchwork.libcamera.org/api/series/5204/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5204",
            "date": "2025-06-04T13:07:34",
            "name": "gstreamer: Miscellaneous cleanups + two fixes",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5204/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23466/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23466/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9422DC3324\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Jun 2025 13:08:06 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6519D68DCE;\n\tWed,  4 Jun 2025 15:08:03 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4ED3D68DBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Jun 2025 15:07:58 +0200 (CEST)",
            "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 484C5E9B;\n\tWed,  4 Jun 2025 15:07:55 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wdbVlFq+\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749042475;\n\tbh=QWQ2kK76rVWquzW+ySsOqLsdhZGBy2YrMXigCm1Rr/I=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=wdbVlFq+gLLbKVJDIrfAYrDMzNFoAU5QcCg9zOlS+3nky9/reASnuxbvGp9aMrW43\n\t6gCzj3noqAWm20zDe9MXpgDIGPzLGV1WCpnup+r/hs4+Dpbom59bsdedo7Z4i1Tc5z\n\t+K+Ld7tjSwJgc+f4pYau0O/JGPSxu0Nip82ObDUI=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Hou Qi <qi.hou@nxp.com>,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>",
        "Subject": "[PATCH v2 5/7] gstreamer: Fix leak of GstQuery and GstBufferPool in\n\terror path",
        "Date": "Wed,  4 Jun 2025 16:07:39 +0300",
        "Message-ID": "<20250604130741.9228-6-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20250604130741.9228-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20250604130741.9228-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The gst_libcamera_create_video_pool() function leaks a GstQuery instance\nand a GstBufferPool instance in an error path. Fix the leaks with\ng_autoptr().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 9c0ee491ab63..0be64dd836ca 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -541,9 +541,9 @@ static std::tuple<GstBufferPool *, int>\n gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,\n \t\t\t\tGstCaps *caps, const GstVideoInfo *info)\n {\n-\tGstQuery *query = NULL;\n+\tg_autoptr(GstQuery) query = NULL;\n+\tg_autoptr(GstBufferPool) pool = NULL;\n \tconst gboolean need_pool = true;\n-\tGstBufferPool *pool = NULL;\n \n \t/*\n \t * Get the peer allocation hints to check if it supports the meta API.\n@@ -587,8 +587,7 @@ gst_libcamera_create_video_pool(GstLibcameraSrc *self, GstPad *srcpad,\n \t\treturn { NULL, -EINVAL };\n \t}\n \n-\tgst_query_unref(query);\n-\treturn { pool, 0 };\n+\treturn { reinterpret_cast<GstBufferPool *>(g_steal_pointer(&pool)), 0 };\n }\n \n /* Must be called with stream_lock held. */\n",
    "prefixes": [
        "v2",
        "5/7"
    ]
}