Module Name: src Committed By: mrg Date: Wed Dec 13 06:51:57 UTC 2023
Modified Files: src/sbin/gpt: gpt.c Log Message: avoid use after free. skip the QUIET check already in gpt_warn(). To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sbin/gpt/gpt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/gpt/gpt.c diff -u src/sbin/gpt/gpt.c:1.86 src/sbin/gpt/gpt.c:1.87 --- src/sbin/gpt/gpt.c:1.86 Mon Dec 11 12:45:22 2023 +++ src/sbin/gpt/gpt.c Wed Dec 13 06:51:57 2023 @@ -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.86 2023/12/11 12:45:22 mlelstv Exp $"); +__RCSID("$NetBSD: gpt.c,v 1.87 2023/12/13 06:51:57 mrg Exp $"); #endif #include <sys/param.h> @@ -604,9 +604,8 @@ gpt_open(const char *dev, int flags, int close: if (gpt->fd != -1) close(gpt->fd); + gpt_warn(gpt, "No GPT found"); free(gpt); - if (!(flags & GPT_QUIET)) - gpt_warn(gpt, "No GPT found"); return NULL; }