[{"id":270,"web_url":"https://patchwork.libcamera.org/comment/270/","msgid":"<20190109154001.GB24252@bigcity.dyn.berto.se>","date":"2019-01-09T15:40:01","subject":"Re: [libcamera-devel] [PATCH] libcamera: device_enumerator: Fix\n\tmemory leak in error path","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for fixing my mistake :-)\n\nOn 2019-01-08 16:46:21 +0200, Laurent Pinchart wrote:\n> The DeviceEnumerator::create() function allocates a\n> DeviceEnumeratorUdev and fails to delete it in the error path, causing a\n> memory leak. Fix it.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/device_enumerator.cpp | 2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/src/libcamera/device_enumerator.cpp b/src/libcamera/device_enumerator.cpp\n> index f1d016db64a0..0d18e75525af 100644\n> --- a/src/libcamera/device_enumerator.cpp\n> +++ b/src/libcamera/device_enumerator.cpp\n> @@ -140,6 +140,8 @@ DeviceEnumerator *DeviceEnumerator::create()\n>  \tif (!enumerator->init())\n>  \t\treturn enumerator;\n>  \n> +\tdelete enumerator;\n> +\n>  \t/*\n>  \t * Either udev is not available or udev initialization failed. Fall back\n>  \t * on the sysfs enumerator.\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 09AC160B2D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  9 Jan 2019 16:40:03 +0100 (CET)","by mail-lj1-x242.google.com with SMTP id n18-v6so6879916lji.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 09 Jan 2019 07:40:03 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\ta19sm12761098lfi.57.2019.01.09.07.40.01\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 09 Jan 2019 07:40:01 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=veGpggiGJshRyTB5PMxwd8/ARRlcDwRMDoz0UU8AXUU=;\n\tb=qAtoiNJq+cK9JcpHg51L3FphNQ4VbA+Es9w/ukEEHmL30rcJcg0hcXvswdvCvG1tYK\n\tILbrdE1q6eb7Se7ggbe1e78wZwEFgTmZP5qjcyk6fs8PPYpcoVKGfVYpuLvuVH8sKDIp\n\tvHlZ7eoRYciRBm9Yr86HQwQhPkcR3uhwVekFonG962LyYLr8noS4PamXODMA61ehI0kq\n\tr4q9micnu1seAPocF2BCSya8Bo7q4hdcxipcXrKNJlReEtsGGORDYloLC7NOzYzXIigI\n\t7PefFDHEmwpaA+1QI2AxmR54vzoLinwxdh4qSNQJWzKlwAOyXl6LnxnCHxRbm8EIipe4\n\tSn7A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=veGpggiGJshRyTB5PMxwd8/ARRlcDwRMDoz0UU8AXUU=;\n\tb=KbQmLazdNw7cy7fJR2VuDVc9eHsGVFlVL0DxiGfPefbzCXWS2eFagRH5w0Cx1X+/Sn\n\tTWjFQTS5Ta0DNwkZ2RBZZ7jVQUIh7XsZTs3QPA/jSTRpGjWmRiUXQw49qXd1WCKucHHn\n\t2mDAPt9WAugTLZXLqS52PUO2TsslXFkYrOvpSKOuUrrD/eb4RYXBTxy38Q0nA8BYZqTQ\n\tys6B/Wvdo9QKo9pEW41JmPf3yK4aqsQYnE+E3XrBFUdIvdstZnFksZwt27I5vO3esTML\n\t+M8zrxPgG9d/U05Iq3CjqVvnQ0xAhi/p2VhnznLPueyrmEJvI8F5vCVucj4m84oJINZ/\n\tbhBw==","X-Gm-Message-State":"AJcUukdYzqdt1PAh83OfbBpOI1jEtTg+QOs7NUaxj8uds6Zd83g9vxIY\n\t9TyJC4LZrjtDfZs+Lz0GVRLp2w+I01k=","X-Google-Smtp-Source":"ALg8bN7prUKNle1SpCk6QPZOZAAeU+3wLJogKKqz1dfwGRgARRufUGQauDs86hUvxCAHpRPiALTArQ==","X-Received":"by 2002:a2e:868c:: with SMTP id\n\tl12-v6mr4105777lji.90.1547048402338; \n\tWed, 09 Jan 2019 07:40:02 -0800 (PST)","Date":"Wed, 9 Jan 2019 16:40:01 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190109154001.GB24252@bigcity.dyn.berto.se>","References":"<20190108144621.10546-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190108144621.10546-1-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] libcamera: device_enumerator: Fix\n\tmemory leak in error path","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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":"Wed, 09 Jan 2019 15:40:03 -0000"}}]