Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt Do not try to close a NULL gpt. Fixes the core dump...



details:   https://anonhg.NetBSD.org/src/rev/baaa0e3fe2af
branches:  trunk
changeset: 452165:baaa0e3fe2af
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jun 20 10:41:58 2019 +0000

description:
Do not try to close a NULL gpt. Fixes the core dump part of PR bin/54312

diffstat:

 sbin/gpt/gpt.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 5764e9db9298 -r baaa0e3fe2af sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Thu Jun 20 10:29:53 2019 +0000
+++ b/sbin/gpt/gpt.c    Thu Jun 20 10:41:58 2019 +0000
@@ -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 @@
 gpt_close(gpt_t gpt)
 {
 
+       if (gpt == NULL)
+               return;
+
        if (!(gpt->flags & GPT_MODIFIED) || !(gpt->flags & GPT_SYNC))
                goto out;
 



Home | Main Index | Thread Index | Old Index