From patchwork Mon Apr 13 10:46:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3430 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A0CED6279B for ; Mon, 13 Apr 2020 12:46:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="yjb5j75B"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=Y03Ll6yzLr1iyJPFMtkLojTteG6/i02TnsXQjRnuus8=; b=yjb5j75BBJbv5cQpnEAk/TLQ9J1jQa+Z27gISA2gwBRkLGKnAMByyoo+YHYAK3+ihVUq 1dHeI+f/ZHWlzIN9k6jJe1SNqP4sfo+F4LQvMXOman+5OEm8HpSIR1zxVy6vzxySvBZPn1 8wWU6+E1Fyyk/KeirvEmdxn4Uae4/WSFc= Received: by filterdrecv-p3iad2-8ddf98858-w5zgs with SMTP id filterdrecv-p3iad2-8ddf98858-w5zgs-17-5E94431A-43 2020-04-13 10:46:51.137941207 +0000 UTC m=+1589965.432268828 Received: from mail.uajain.com (unknown) by ismtpd0008p1maa1.sendgrid.net (SG) with ESMTP id rXvBFzRsR9qGz3Ae-Nr7xw Mon, 13 Apr 2020 10:46:50.374 +0000 (UTC) From: Umang Jain Date: Mon, 13 Apr 2020 10:46:51 +0000 (UTC) Message-Id: <20200413104631.12276-2-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/L3L9rFqlwE4KPcIgOyDPOiX995eQdp4XFd3IZu5+c97D8x47w6im9u3eJmzXBdYWObWYD7xrkJRveqCVzi+AY+njAWbDzk+QB8hB1LzWzudFaQ2wEm7/UDmyxHMrmX5lW9n/OeuLDxxnyEqQ/LsPSE9XmZhklGKPC06avxeWc/2vXXY92VUHEhDyxAuUCAX1H16e5XY2Ys21ik6KW7dZwv1P2X9G83Chlprw== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH 1/4] test: ipc: unixsocket: Close open fds on error paths X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 10:46:53 -0000 Pointed out by Coverity DefectId=279099 Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- test/ipc/unixsocket.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/ipc/unixsocket.cpp b/test/ipc/unixsocket.cpp index f53042b..5348f35 100644 --- a/test/ipc/unixsocket.cpp +++ b/test/ipc/unixsocket.cpp @@ -145,6 +145,7 @@ private: if (num < 0) { cerr << "Read failed" << endl; + close(outfd); stop(-EIO); return; } else if (!num) @@ -152,6 +153,7 @@ private: if (write(outfd, buf, num) < 0) { cerr << "Write failed" << endl; + close(outfd); stop(-EIO); return; }