From ee993850557956b27e55fa65b556e9fd65e21593 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 6 May 2015 23:52:49 +0000 Subject: [PATCH] fix a fd leak in an error path in code under #ifdef DEBUG --- lib/libc/gmon/gmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c index 89cfdc2a14f..e790c8d1552 100644 --- a/lib/libc/gmon/gmon.c +++ b/lib/libc/gmon/gmon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gmon.c,v 1.23 2015/01/16 16:48:51 deraadt Exp $ */ +/* $OpenBSD: gmon.c,v 1.24 2015/05/06 23:52:49 jsg Exp $ */ /*- * Copyright (c) 1983, 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -230,6 +230,7 @@ _mcleanup(void) log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664); if (log < 0) { perror("mcount: gmon.log"); + close(fd); return; } snprintf(dbuf, sizeof dbuf, "[mcleanup1] kcount 0x%x ssiz %d\n", -- 2.20.1