From 05051e2898ece037ee753daffd609db313648588 Mon Sep 17 00:00:00 2001 From: Juli Mallett Date: Wed, 5 Jun 2002 01:36:30 +0000 Subject: [PATCH] Returning NULL here if malloc(3) fails is silly, at this point in the codepath we have't malloc(3)'d nearly as much as we probably will, so errx(3) away, instead of waiting for something to fail yet again later on. --- bin/ps/fmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c index c0c11f09ee9..92638869227 100644 --- a/bin/ps/fmt.c +++ b/bin/ps/fmt.c @@ -125,7 +125,7 @@ fmt_argv(char **argv, char *cmd, size_t maxlen) } cp = malloc(len); if (cp == NULL) - return (NULL); + errx(1, "malloc failed"); if (ap == NULL) sprintf(cp, " (%.*s)", (int)maxlen, cmd); else if (strncmp(cmdpart(argv[0]), cmd, maxlen) != 0)