From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62035 invoked by alias); 29 Aug 2017 09:07:06 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 34025 invoked by uid 89); 29 Aug 2017 09:02:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 86797552DB Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=fweimer@redhat.com Subject: Re: [PATCH 1/2] openpty: close slave pty fd on error To: Christian Brauner , libc-alpha@sourceware.org, stgraber@stgraber.org, serge@hallyn.com References: <20170826134449.26527-1-christian.brauner@ubuntu.com> From: Florian Weimer Message-ID: Date: Tue, 29 Aug 2017 09:07:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170826134449.26527-1-christian.brauner@ubuntu.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg01220.txt.bz2 On 08/26/2017 03:44 PM, Christian Brauner wrote: > fail: > close (master); > + if (slave != -1) > + close(slave); > return -1; This is inconsistent with how the code frees buf if there is an error: For buf, the free operation happens before the fail tail. I think we should keep this consistent: either free exactly what is needed, or have a single function exit which checks for initialization and frees what has been allocated. Thanks, Florian