{"id":13846,"url":"https://patchwork.libcamera.org/api/1.1/patches/13846/?format=json","web_url":"https://patchwork.libcamera.org/patch/13846/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210914121700.122591-3-umang.jain@ideasonboard.com>","date":"2021-09-14T12:17:00","name":"[libcamera-devel,2/2] test: gstreamer_single_stream_test: Fix memory leak","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"06bd4509850c00f97bf2084528bf582d2dbc8fc5","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13846/mbox/","series":[{"id":2528,"url":"https://patchwork.libcamera.org/api/1.1/series/2528/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2528","date":"2021-09-14T12:16:58","name":"test: gstreamer: cleanup and memory leak fixes","version":1,"mbox":"https://patchwork.libcamera.org/series/2528/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13846/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13846/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 A5CAFBDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Sep 2021 12:17:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 76A4A6918E;\n\tTue, 14 Sep 2021 14:17:20 +0200 (CEST)","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 C52EB60249\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Sep 2021 14:17:18 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.94])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BB1222A5;\n\tTue, 14 Sep 2021 14:17:17 +0200 (CEST)"],"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=\"IMzBew5v\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631621838;\n\tbh=6SRV+8Wn8GmIzPDhZOaCy5e8PjQ0Rtio4hjNnuU4ylA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=IMzBew5vbF8TLrprbNhL+6So/vnXGFEbzmky0sJh6St6iVN5CilTTRbDsFdxggdYC\n\tUtNTKiLrAZ/43tU5FMxxw7Nimk2fSDkb8dJ/QjNBHNIleNnNW5S5uT9IeZN0wXPPT7\n\tFoZhlQh6qyDdglvmZMcSv1TzEbQlGQdZnsOdGFUE=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 14 Sep 2021 17:47:00 +0530","Message-Id":"<20210914121700.122591-3-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210914121700.122591-1-umang.jain@ideasonboard.com>","References":"<20210914121700.122591-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 2/2] test: gstreamer_single_stream_test:\n\tFix memory leak","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 test hold a valid reference to convert0_ and sink0_ but\nnot released. This results in a memory leak and can be checked\nvia valgrind. Drop the references with test cleanup() virtual\nfunction.\n\nValgrind log:\n==95352==    definitely lost: 1,688 bytes in 2 blocks\n==95352==    indirectly lost: 11,901 bytes in 37 blocks\n\nThe patch fixes the leaks reported by valgrind above to:\n==120397==    definitely lost: 0 bytes in 0 blocks\n==120397==    indirectly lost: 0 bytes in 0 blocks\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n test/gstreamer/gstreamer_single_stream_test.cpp | 6 ++++++\n 1 file changed, 6 insertions(+)","diff":"diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\nindex d992455c..763a77b1 100644\n--- a/test/gstreamer/gstreamer_single_stream_test.cpp\n+++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n@@ -70,6 +70,12 @@ protected:\n \t\treturn TestPass;\n \t}\n \n+\tvoid cleanup() override\n+\t{\n+\t\tgst_object_unref(convert0_);\n+\t\tgst_object_unref(sink0_);\n+\t}\n+\n private:\n \tGstElement *convert0_;\n \tGstElement *sink0_;\n","prefixes":["libcamera-devel","2/2"]}