From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:42670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXBtq-0005Hn-5T for qemu-devel@nongnu.org; Tue, 30 Apr 2013 10:51:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXBtp-0002Ob-0w for qemu-devel@nongnu.org; Tue, 30 Apr 2013 10:51:22 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:40507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXBto-0002OE-FO for qemu-devel@nongnu.org; Tue, 30 Apr 2013 10:51:20 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 1 May 2013 00:41:48 +1000 From: Anthony Liguori In-Reply-To: <1367250772-17928-1-git-send-email-jlarrew@linux.vnet.ibm.com> References: <1367250772-17928-1-git-send-email-jlarrew@linux.vnet.ibm.com> Date: Tue, 30 Apr 2013 09:51:08 -0500 Message-ID: <87ppxcnkbn.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH] libqtest: only call fclose() on open files List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jesse Larrew , qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org Jesse Larrew writes: > libqtest.c can segfault when calling fclose() if the pidfile wasn't > opened successfully. This patch fixes the issue. > > Signed-off-by: Jesse Larrew Reviewed-by: Anthony Liguori Regards, Anthony Liguori > --- > tests/libqtest.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/libqtest.c b/tests/libqtest.c > index 884f959..879ffe9 100644 > --- a/tests/libqtest.c > +++ b/tests/libqtest.c > @@ -99,8 +99,8 @@ static pid_t qtest_qemu_pid(QTestState *s) > if (fgets(buffer, sizeof(buffer), f)) { > pid = atoi(buffer); > } > + fclose(f); > } > - fclose(f); > return pid; > } > > -- > 1.7.11.7