Show a patch.

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

{
    "id": 10656,
    "url": "https://patchwork.libcamera.org/api/patches/10656/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10656/",
    "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": "<20201212185116.29611-2-laurent.pinchart@ideasonboard.com>",
    "date": "2020-12-12T18:51:14",
    "name": "[libcamera-devel,1/3] libcamera: pipeline: raspberrypi: Don't leak RPiCameraData::sensor_",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "218a65a55b607718b2c967a096eb8c067d112f6f",
    "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/10656/mbox/",
    "series": [
        {
            "id": 1531,
            "url": "https://patchwork.libcamera.org/api/series/1531/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1531",
            "date": "2020-12-12T18:51:14",
            "name": "libcamera: Fix leaks and simplify object management with std::unique_ptr<>",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1531/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10656/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10656/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 C6667BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 12 Dec 2020 18:51:29 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2D6C860380;\n\tSat, 12 Dec 2020 19:51:29 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D11A60337\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 12 Dec 2020 19:51:27 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A29832C2;\n\tSat, 12 Dec 2020 19:51:26 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AtVdjFo5\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1607799086;\n\tbh=t+NbMzSiRDJKmzrb/v/FRmQiLaADl4AiYjkdDM9tMTM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=AtVdjFo5gCUVuLxzhtTQUgefouM3OrPYXul8GSAUg9GSTyqCdrFldUmFURvbpIQYL\n\t2Hc8h3wlNwR9qvcSEDIFTDr7qPHIjsUBjKsX4Nud52AaEFdo4Urn66+foofPp+AQ3U\n\t7PqtKeWFxTigsbLdqY1lAcquNQ3YmFGQh+XrEY+A=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Sat, 12 Dec 2020 20:51:14 +0200",
        "Message-Id": "<20201212185116.29611-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201212185116.29611-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20201212185116.29611-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 1/3] libcamera: pipeline: raspberrypi:\n\tDon't leak RPiCameraData::sensor_",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The CameraSensor instance stored in RPiCameraData::sensor_ is allocated\ndynamically and never deleted. Fix the memory leak by storing it in a\nstd::unique_ptr<>.\n\nFixes: 740fd1b62f67 (\"libcamera: pipeline: Raspberry Pi pipeline handler\")\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 439c21ce4566..7a5f5881b9b3 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -7,6 +7,7 @@\n #include <algorithm>\n #include <assert.h>\n #include <fcntl.h>\n+#include <memory>\n #include <mutex>\n #include <queue>\n #include <sys/mman.h>\n@@ -134,7 +135,7 @@ class RPiCameraData : public CameraData\n {\n public:\n \tRPiCameraData(PipelineHandler *pipe)\n-\t\t: CameraData(pipe), sensor_(nullptr), state_(State::Stopped),\n+\t\t: CameraData(pipe), state_(State::Stopped),\n \t\t  supportsFlips_(false), flipsAlterBayerOrder_(false),\n \t\t  updateScalerCrop_(true), dropFrameCount_(0), ispOutputCount_(0)\n \t{\n@@ -158,7 +159,7 @@ public:\n \tvoid handleState();\n \tvoid applyScalerCrop(const ControlList &controls);\n \n-\tCameraSensor *sensor_;\n+\tstd::unique_ptr<CameraSensor> sensor_;\n \t/* Array of Unicam and ISP device streams and associated buffers/streams. */\n \tRPi::Device<Unicam, 2> unicam_;\n \tRPi::Device<Isp, 4> isp_;\n@@ -948,7 +949,7 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)\n \t/* Identify the sensor. */\n \tfor (MediaEntity *entity : unicam_->entities()) {\n \t\tif (entity->function() == MEDIA_ENT_F_CAM_SENSOR) {\n-\t\t\tdata->sensor_ = new CameraSensor(entity);\n+\t\t\tdata->sensor_ = std::make_unique<CameraSensor>(entity);\n \t\t\tbreak;\n \t\t}\n \t}\n",
    "prefixes": [
        "libcamera-devel",
        "1/3"
    ]
}