{"id":2499,"url":"https://patchwork.libcamera.org/api/patches/2499/?format=json","web_url":"https://patchwork.libcamera.org/patch/2499/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200104050947.7673-4-laurent.pinchart@ideasonboard.com>","date":"2020-01-04T05:09:36","name":"[libcamera-devel,03/14] libcamera: bound_method: Fix memory leak with direct connections","commit_ref":"451ffd1fcd4e1287c3a600e83e61028aab74be59","pull_url":null,"state":"accepted","archived":false,"hash":"8c86cad7c3e61440180c79d8c40f88a638fe7518","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2499/mbox/","series":[{"id":600,"url":"https://patchwork.libcamera.org/api/series/600/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=600","date":"2020-01-04T05:09:33","name":"object: Propagate return value of invoked method","version":1,"mbox":"https://patchwork.libcamera.org/series/600/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2499/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2499/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EDED960466\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jan 2020 06:10:03 +0100 (CET)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A906A49\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  4 Jan 2020 06:10:03 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1578114603;\n\tbh=iuKvvqBOOmGKweNTex1vbZX9NzTjfQrevg48E95VhDM=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=X7ghZHeXl6j+5w6TCeIJYu5QP08KfBcxT9uSGo2gAU9OFah6StJopQdon6XD16NZr\n\tCO7sJHiqy4k82mjpyEnjfp7orSHs4E0l0PAu3KOwbAuP9z/oCS/neDtpjLV7LPtcF/\n\t22/0jeN3YLJyLe+1d+PRvUFTLgNA2384tYEPhhk0=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  4 Jan 2020 07:09:36 +0200","Message-Id":"<20200104050947.7673-4-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.24.1","In-Reply-To":"<20200104050947.7673-1-laurent.pinchart@ideasonboard.com>","References":"<20200104050947.7673-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 03/14] libcamera: bound_method: Fix memory\n\tleak with direct connections","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>","X-List-Received-Date":"Sat, 04 Jan 2020 05:10:04 -0000"},"content":"When BoundMethodBase::activatePack() is called with the connection type\nset to ConnectionTypeDirect, the method isn't deleted even if\ndeleteMethod is true, as is the case when called from\nObject::invokeMethod(). This causes a memory leak. Fix it.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/bound_method.cpp | 2 ++\n 1 file changed, 2 insertions(+)","diff":"diff --git a/src/libcamera/bound_method.cpp b/src/libcamera/bound_method.cpp\nindex 4c0cd415a3f1..45c765774801 100644\n--- a/src/libcamera/bound_method.cpp\n+++ b/src/libcamera/bound_method.cpp\n@@ -62,6 +62,8 @@ void BoundMethodBase::activatePack(void *pack, bool deleteMethod)\n \tcase ConnectionTypeDirect:\n \tdefault:\n \t\tinvokePack(pack);\n+\t\tif (deleteMethod)\n+\t\t\tdelete this;\n \t\tbreak;\n \n \tcase ConnectionTypeQueued: {\n","prefixes":["libcamera-devel","03/14"]}