From 76be93e4ab37ed5e31de2fc8ec6207b082491162 Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Tue, 26 Mar 2024 09:49:22 +0100 Subject: [PATCH] uuidgen: use xmalloc instead of malloc (#2714) Use xmalloc to make sure we don't reference a NULL pointer in error case. Signed-off-by: Thorsten Kukuk (cherry picked from commit 0b14dcd755565f3e48f4c30011b3dfe783558393) --- misc-utils/uuidgen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c index 27429223ce..57769c1f40 100644 --- a/misc-utils/uuidgen.c +++ b/misc-utils/uuidgen.c @@ -19,6 +19,7 @@ #include "closestream.h" #include "strutils.h" #include "optutils.h" +#include "xalloc.h" static void __attribute__((__noreturn__)) usage(void) { @@ -57,7 +58,7 @@ badstring: errtryhelp(EXIT_FAILURE); } - value2 = malloc(*valuelen / 2 + 1); + value2 = xmalloc(*valuelen / 2 + 1); for (x = n = 0; n < *valuelen; n++) { c = value[n]; -- 2.47.3