From: Thorsten Kukuk Date: Tue, 26 Mar 2024 08:49:22 +0000 (+0100) Subject: uuidgen: use xmalloc instead of malloc (#2714) X-Git-Tag: v2.42-start~475^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0b14dcd755565f3e48f4c30011b3dfe783558393;p=thirdparty%2Futil-linux.git 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 --- diff --git a/misc-utils/uuidgen.c b/misc-utils/uuidgen.c index 27429223c..57769c1f4 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];