From 6cb17fa895ac115ee28362d2d2fad8de9f5152db Mon Sep 17 00:00:00 2001 From: jmallett Date: Wed, 5 Jun 2002 01:36:30 +0000 Subject: 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(-) (limited to 'bin/ps') diff --git a/bin/ps/fmt.c b/bin/ps/fmt.c index c0c11f0..9263886 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) -- cgit v1.1