{"id":13426,"url":"https://patchwork.libcamera.org/api/1.1/patches/13426/?format=json","web_url":"https://patchwork.libcamera.org/patch/13426/","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":"<20210821131202.3029523-1-vedantparanjape160201@gmail.com>","date":"2021-08-21T13:12:02","name":"[libcamera-devel,v2] 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/13426/mbox/","series":[{"id":2380,"url":"https://patchwork.libcamera.org/api/1.1/series/2380/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2380","date":"2021-08-21T13:12:02","name":"[libcamera-devel,v2] test: gstreamer: Clean up memory management","version":2,"mbox":"https://patchwork.libcamera.org/series/2380/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13426/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13426/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 56766BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 21 Aug 2021 13:12:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 87FEA68895;\n\tSat, 21 Aug 2021 15:12:26 +0200 (CEST)","from mail-pg1-x532.google.com (mail-pg1-x532.google.com\n\t[IPv6:2607:f8b0:4864:20::532])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E6F996025E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Aug 2021 15:12:24 +0200 (CEST)","by mail-pg1-x532.google.com with SMTP id r2so12012823pgl.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 21 Aug 2021 06:12:24 -0700 (PDT)","from localhost.localdomain ([110.226.224.21])\n\tby smtp.googlemail.com with ESMTPSA id\n\tg85sm2029084pfb.172.2021.08.21.06.12.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 21 Aug 2021 06:12:22 -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=\"HHBCw+m0\"; 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=OeSKpN3Jcmy009D4E90Pwrj579TdeaQ4c/VCA+D3rp4=;\n\tb=HHBCw+m0oIpE4FiBIXf9lMvKlcv8A4PxnNMCLnPaPCxwKtmDuvA9Y136ClNOwYNhSC\n\tX7p8Xyv/pntihTYpawQ8WynRcZCbDkxTvQVfcQak50tuLOeNWQo8ylFTi38cpHKLyj8X\n\t/9oWTLPrMtc95tJjz+/+WSLbskYX5vn4Fv0jVSCl0w1CH1wZZI6WjI2SScqy9BlEmk0M\n\tP7jZr+uFCNXS9ZFoPLWSimN86rP7JWMX7hQZeZ2CAW4Hm5/50FeqwRd7bJ6A22AjHNHU\n\tJpQ3BHXxYkYxAoMxH4Yz0P+fQKSZ9HTzyqdmX/a6EK8qlGlFYOAKM3Y8kyLMQvIk2FGg\n\tTAkg==","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=OeSKpN3Jcmy009D4E90Pwrj579TdeaQ4c/VCA+D3rp4=;\n\tb=k3JfMviY33StNWZVxR4WR72wrsBwSi9K+tCLw4ACfrxQIFTAZ7w2uPXjnHDsq1i9V3\n\t6ekiA8kE5x+kLfjovvv96tNr1jLiqX6zV7xubQKCEZju61D5cUns8GxW2mdwMkf0UiqW\n\tOrBNNcHad8ow6gXDlEs9nyEyrTMmhKmrIXyAQrZ3iKDoNWAbn7toyqrq8LF5e3B9hx+u\n\ttsyaFfixJd/CD9OR3KRqy207Way8xulkD1Oz7EqxMKB71tO3pZPlReKfoslAJrFbTV9s\n\tGbJzvJu7bU289PHwAAwz3wOOKWEZPQ5Ftrnb5AZwktlqK8swDv9oKKXO/QcIwgto4svk\n\tCv5g==","X-Gm-Message-State":"AOAM532jUndsPdFHxuexcNKYIL2CluwPuGQrL3F2hbYwpm7zXjSeDpgA\n\t9N5oq8y4HqjCVpWjdXxwaESXjP/Hqx4PWA==","X-Google-Smtp-Source":"ABdhPJy0nfl8qCKHWMvBFHyU9bUrgz9wHMagjh2VbBZKPrZv8N4R1mF1tlbunPosVzS54wqURE/Uag==","X-Received":"by 2002:a63:db4a:: with SMTP id x10mr9667977pgi.30.1629551542851;\n\tSat, 21 Aug 2021 06:12:22 -0700 (PDT)","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 21 Aug 2021 18:42:02 +0530","Message-Id":"<20210821131202.3029523-1-vedantparanjape160201@gmail.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] 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 simplifies memory management, i.e., by replacing bare gpointers with\ng_autoptr or g_autofree according to use case.\n\nWhile at it also updated time representation of timeout variable with\nGST_SECOND\n\nSigned-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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","v2"]}