{"id":3431,"url":"https://patchwork.libcamera.org/api/patches/3431/?format=json","web_url":"https://patchwork.libcamera.org/patch/3431/","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":"<20200413104631.12276-3-email@uajain.com>","date":"2020-04-13T10:46:53","name":"[libcamera-devel,2/4] test: ipc: unixsocket: Close open fds on error paths","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"8bd407b828cfc906ada01aaeaaa8e52f9a352171","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3431/mbox/","series":[{"id":803,"url":"https://patchwork.libcamera.org/api/series/803/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=803","date":"2020-04-13T10:46:34","name":"Fix resource leaks pointed out by coverity scans","version":1,"mbox":"https://patchwork.libcamera.org/series/803/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3431/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3431/checks/","tags":{},"headers":{"Return-Path":"<bounces+15657259-5c31-libcamera-devel=lists.libcamera.org@em7280.uajain.com>","Received":["from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D20062826\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Apr 2020 12:46:54 +0200 (CEST)","by filterdrecv-p3iad2-8ddf98858-w5zgs with SMTP id\n\tfilterdrecv-p3iad2-8ddf98858-w5zgs-17-5E94431D-1\n\t2020-04-13 10:46:53.157713672 +0000 UTC m=+1589967.452041277","from mail.uajain.com (unknown)\n\tby ismtpd0001p1hnd1.sendgrid.net (SG) with ESMTP\n\tid yqI_hkVRRvu_j8y6qNYx2A Mon, 13 Apr 2020 10:46:52.812 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=uajain.com\n\theader.i=@uajain.com header.b=\"e/3gpEAy\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:\n\tcontent-transfer-encoding:content-type;\n\ts=s1; bh=Qtp/cDrwBACdJFlkVAHi6B001l4L/ErjvF4T5OKrb7Q=;\n\tb=e/3gpEAy0VPsDPJmM1xXwB2WUjMJMd/PzZdJRvgeeszNSFuqPoOd+7ZK7ONbLv/+UqpL\n\tv0oLOKGp3c2M2vuyCa8RvnPYq6UImlijTFe1H6wwT3o95FwpLv21vw+Ap23AEj1tM2/qLT\n\t2N6tjHIgvKqfSJ6sdRyDKyehgLbWiGgjw=","From":"Umang Jain <email@uajain.com>","Date":"Mon, 13 Apr 2020 10:46:53 +0000 (UTC)","Message-Id":"<20200413104631.12276-3-email@uajain.com>","In-Reply-To":"<20200413104631.12276-1-email@uajain.com>","References":"<20200413104631.12276-1-email@uajain.com>","Mime-Version":"1.0","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcOiinPhbAFGEz1ue/PLGCvOLaxg0kHovbGbOOssNurM64hYKBwWjcYm5ttZtha3r5C57EH5JF3RbbqdsmHlXRa1Y257LaASFxm2dGkkLbhERkfSxNyQPH6xTsITsDlVrzMBrkn65JdU46YT4iX0jxATN/jqYf/7CmLbBNSi++ZscBc3WYtduW6hHx40fFjFboMRp9hT8UZZc81Qcpt3yWeQ==","To":"libcamera-devel@lists.libcamera.org","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=us-ascii","Subject":"[libcamera-devel] [PATCH 2/4] test: ipc: unixsocket: Close open fds\n\ton error paths","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":"Mon, 13 Apr 2020 10:46:55 -0000"},"content":"Pointed out by Coverity DefectId=279052\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n test/ipc/unixsocket.cpp | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)","diff":"diff --git a/test/ipc/unixsocket.cpp b/test/ipc/unixsocket.cpp\nindex 5348f35..4fc6606 100644\n--- a/test/ipc/unixsocket.cpp\n+++ b/test/ipc/unixsocket.cpp\n@@ -470,8 +470,10 @@ private:\n \t\tint size = 0;\n \t\tfor (unsigned int i = 0; i < num; i++) {\n \t\t\tint clone = dup(fd);\n-\t\t\tif (clone < 0)\n+\t\t\tif (clone < 0) {\n+\t\t\t\tclose(fd);\n \t\t\t\treturn clone;\n+\t\t\t}\n \n \t\t\tsize += calculateLength(clone);\n \t\t\tmessage->fds.push_back(clone);\n","prefixes":["libcamera-devel","2/4"]}