From patchwork Fri May 15 12:42:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3795 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 0471860E04 for ; Fri, 15 May 2020 14:42:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="eO84GZUU"; 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=nwEIAkapDHGcHhUqs9QsOYZYpbdReQVrJEj7JvJUIhQ=; b=eO84GZUUUx+BJofUTPUDgpix6bxrwwKX9/sOaAWB5lwwYvyxJ7AelY2ffLkQ2p13lky+ 4ueb43BmbFaJM26qZWs+2yKQBTvrXkooGemoZ6TE4EbHAuFnOmYbWjqfT3qVEe63gKVgtK 80sOE+YNMlAba4G5KlJ17dFE+blcYFW8s= Received: by filterdrecv-p3iad2-8ddf98858-7qsdm with SMTP id filterdrecv-p3iad2-8ddf98858-7qsdm-19-5EBE8E4C-32 2020-05-15 12:42:52.653305372 +0000 UTC m=+4361727.335562953 Received: from mail.uajain.com (unknown) by ismtpd0007p1maa1.sendgrid.net (SG) with ESMTP id P5V8PnQwRdWqfWPesnwfjg Fri, 15 May 2020 12:42:52.051 +0000 (UTC) From: Umang Jain Date: Fri, 15 May 2020 12:42:52 +0000 (UTC) Message-Id: <20200515124245.18040-2-email@uajain.com> In-Reply-To: <20200515124245.18040-1-email@uajain.com> References: <20200515124245.18040-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcYDswUgqLHty1lirORaEntVnOx/r7D4hv5S0oXe9vaj0hrpQTq3hRAmZeRvRAd4sctXteVeh8mmJPDovpQNo1MOQ9n1stXIdPkAQ+yhmSbZsuw2DGXM57HKiJ7Gh6Rh9dN71auyHh3JuIzPDLFwZZ1v41Yjatwylor5sLzLHpuHCcAB/qI1exfztX8MoFxxX52AEuLFXE/lnvn2b1Sqd1og== To: libcamera-devel Subject: [libcamera-devel] [PATCH v2 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: Fri, 15 May 2020 12:42:54 -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; }