{"id":13424,"url":"https://patchwork.libcamera.org/api/1.1/patches/13424/?format=json","web_url":"https://patchwork.libcamera.org/patch/13424/","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":"<20210821083957.2989120-1-vedantparanjape160201@gmail.com>","date":"2021-08-21T08:39:57","name":"[libcamera-devel,v1] test: gstreamer: Clean up memory management","commit_ref":"dac58fdd2a84e2e00a90f3c568c57972c0be0b6f","pull_url":null,"state":"accepted","archived":false,"hash":"ce052d77379700ab3f703cbaa190616f15d17c7d","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/1.1/people/85/?format=json","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13424/mbox/","series":[{"id":2378,"url":"https://patchwork.libcamera.org/api/1.1/series/2378/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2378","date":"2021-08-21T08:39:57","name":"[libcamera-devel,v1] test: gstreamer: Clean up memory management","version":1,"mbox":"https://patchwork.libcamera.org/series/2378/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13424/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13424/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 D836ABD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 21 Aug 2021 08:40:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3029E688A5;\n\tSat, 21 Aug 2021 10:40:13 +0200 (CEST)","from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com\n\t[IPv6:2607:f8b0:4864:20::1032])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 891EA6025B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Aug 2021 10:40:11 +0200 (CEST)","by mail-pj1-x1032.google.com with SMTP id\n\tn13-20020a17090a4e0d00b0017946980d8dso15391632pjh.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Aug 2021 01:40:11 -0700 (PDT)","from localhost.localdomain ([110.226.224.21])\n\tby smtp.googlemail.com with ESMTPSA id\n\ty13sm12439126pjr.50.2021.08.21.01.40.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 21 Aug 2021 01:40:08 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"ilCcjrIe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=dwf2QalhblF7sRl7woO6rbk5bo8MCFRQYBktJJKazcg=;\n\tb=ilCcjrIe47XdajKI9vF8f17dL4XSR8UE0ak8ZD/f9YR9GPysdpFJ3xDDibtAz5j/1Z\n\trTdla9vtl00JB5I0yverWQXDmfrQ2I4NtsbjLCptXGYORgMAAY4k5d1Tc+WbPH3Bk6gj\n\te+g1wLl8uBAvRWBy2ngJY5hOJJId1yRYeUQ5NQMIppy3r+vGIpI521RQAxjSLQyKpK8y\n\tmBdMtc+atxdjG8xQ+ZMaWy+SwNFlyU2Am5HlvT8sXB9pSJZsKWPXQ9ybTJ7Y/773xOhI\n\tJhLDjoSAnRKq444x2C7mjQzOxrF467FOwo98YMw6E1styPUu1VivN1fLBQuy/AlNyAd/\n\tdsKg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=dwf2QalhblF7sRl7woO6rbk5bo8MCFRQYBktJJKazcg=;\n\tb=ExNbrstbZ9MSjw6mmGczO75d76BBuPom1emFjaHhJN4U3hLeHfjD2O4cnj1vNNTBEl\n\tuswrQgVbqRmB4yER9yQyZFIdT2lfg3enojMzdSFLU5cSMGEPYmiqfQGg1zvJ2ZnLPtLP\n\tW0GUpSAaSni0VwArBY4xV2468ZP8cZf63VsSnEyaZGX5UBEGZKpYYRFotHq5RZYfxqAj\n\t5qK03x+3S65b3bB0Mt8lBYNbIfbqj6uS/kUvp9odZRjgOLqJxZOi2zgVKPBX8rBBgSKe\n\tmJ/kgjDcSn2rOXYXz8WvWD+19zV0FLiCt7hNDuFKNpYc51z+oFm88rg9EaxGRh0+dveT\n\txBKg==","X-Gm-Message-State":"AOAM532umt/jp16pdpwGguCGxxpZjjSassFNHfznKR9pW/QVg0WWZ3zt\n\tgyFCTgl4OpdRVcN3rowNkJ8H3IL/RZ/vig==","X-Google-Smtp-Source":"ABdhPJzelFc4rVN/nj5Sxwg18dEMdFDOYSMywzDd/qZjb7cy6zW/C7j0cVEQL8oFQm91tNmwCXio3Q==","X-Received":"by 2002:a17:90a:648b:: with SMTP id\n\th11mr9227395pjj.141.1629535209495; \n\tSat, 21 Aug 2021 01:40:09 -0700 (PDT)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 21 Aug 2021 14:09:57 +0530","Message-Id":"<20210821083957.2989120-1-vedantparanjape160201@gmail.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1] test: gstreamer: Clean up memory\n\tmanagement","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>","Cc":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This patch fixes memory management, i.e., replaced bare gpointers with\ng_autoptr or g_autofree according to use case.\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n---\n test/gstreamer/gstreamer_single_stream_test.cpp | 12 ++++--------\n 1 file changed, 4 insertions(+), 8 deletions(-)","diff":"diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\nindex a805fb8a..349dcfa4 100644\n--- a/test/gstreamer/gstreamer_single_stream_test.cpp\n+++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n@@ -55,12 +55,10 @@ protected:\n \t\tsetenv(\"ASAN_OPTIONS\", \"verify_asan_link_order=0\", 1);\n \n \t\t/* Initialize GStreamer */\n-\t\tGError *errInit = nullptr;\n+\t\tg_autoptr(GError) errInit = NULL;\n \t\tif (!gst_init_check(nullptr, nullptr, &errInit)) {\n \t\t\tg_printerr(\"Could not initialize GStreamer: %s\\n\",\n \t\t\t\t   errInit ? errInit->message : \"unknown error\");\n-\t\t\tif (errInit)\n-\t\t\t\tg_error_free(errInit);\n \n \t\t\treturn TestFail;\n \t\t}\n@@ -138,7 +136,7 @@ protected:\n \t\t/* Wait until error or EOS or timeout after 2 seconds */\n \t\tconstexpr GstMessageType msgType =\n \t\t\tstatic_cast<GstMessageType>(GST_MESSAGE_ERROR | GST_MESSAGE_EOS);\n-\t\tconstexpr GstClockTime timeout = 2000000000;\n+\t\tconstexpr GstClockTime timeout = 2 * GST_SECOND;\n \n \t\tg_autoptr(GstBus) bus = gst_element_get_bus(pipeline_);\n \t\tg_autoptr(GstMessage) msg = gst_bus_timed_pop_filtered(bus, timeout, msgType);\n@@ -167,16 +165,14 @@ protected:\n private:\n \tvoid gstreamer_print_error(GstMessage *msg)\n \t{\n-\t\tGError *err;\n-\t\tgchar *debug_info;\n+\t\tg_autoptr(GError) err = NULL;\n+\t\tg_autofree gchar *debug_info = NULL;\n \n \t\tgst_message_parse_error(msg, &err, &debug_info);\n \t\tg_printerr(\"Error received from element %s: %s\\n\",\n \t\t\t   GST_OBJECT_NAME(msg->src), err->message);\n \t\tg_printerr(\"Debugging information: %s\\n\",\n \t\t\t   debug_info ? debug_info : \"none\");\n-\t\tg_clear_error(&err);\n-\t\tg_free(debug_info);\n \t}\n \n \tGstElement *pipeline_;\n","prefixes":["libcamera-devel","v1"]}