From 9573d872f3ad3664e182110c7415f3633e07595c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 17 Mar 2026 21:43:37 +0000 Subject: util/nvmutil: stricter work buf check check it right after initialisation Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 8b5c4381..7652538a 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -162,16 +162,16 @@ main(int argc, char *argv[]) #endif nv = new_xstate(); + if (nv == NULL) err(errno, NULL); + if (nv->f.buf == NULL) + err(EINVAL, "Work buffer not initialised"); nv->argv0 = argv[0]; if (argc < 3) usage(); - if (nv->f.buf == NULL) - err(EINVAL, "Work buffer not initialised"); - f = &nv->f; f->fname = argv[1]; -- cgit v1.2.1