summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2019-06-20 10:41:58 +0000
committermartin <martin@NetBSD.org>2019-06-20 10:41:58 +0000
commit77b26a45eae95b7d1ba21e7808f27fcb590a8d80 (patch)
tree2bf22d646f49c56c7f3a64788b46a6c6d7222032 /sbin
parentd95c8fce9ef9317fe4eaabdda871540447250d93 (diff)
Do not try to close a NULL gpt. Fixes the core dump part of PR bin/54312
Diffstat (limited to 'sbin')
-rw-r--r--sbin/gpt/gpt.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/gpt/gpt.c b/sbin/gpt/gpt.c
index 98de944e04c..ca5cb17d559 100644
--- a/sbin/gpt/gpt.c
+++ b/sbin/gpt/gpt.c
@@ -35,7 +35,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.77 2019/01/27 13:16:05 martin Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.78 2019/06/20 10:41:58 martin Exp $");
#endif
#include <sys/param.h>
@@ -590,6 +590,9 @@ void
gpt_close(gpt_t gpt)
{
+ if (gpt == NULL)
+ return;
+
if (!(gpt->flags & GPT_MODIFIED) || !(gpt->flags & GPT_SYNC))
goto out;