NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/58706: (games) worm.c: display the function name if malloc() fails



>Number:         58706
>Category:       misc
>Synopsis:       (games) worm.c: display the function name if malloc() fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 28 18:55:00 +0000 2024
>Originator:     nightquick
>Release:        
>Organization:
>Environment:
>Description:
When malloc() fails to allocate enough memory, it doesn't output the function name, but only returns "out of memory" error. Adding the function name (here's it's malloc()), makes it a little more clear.
>How-To-Repeat:

>Fix:
--- worm.c	2024-09-28 18:28:01.668649229 +0000
+++ worm.patch.c	2024-09-28 18:30:06.198568089 +0000
@@ -100,7 +100,7 @@
 
 	b = malloc(sizeof(*b));
 	if (b == NULL) {
-		err(EXIT_FAILURE, NULL);
+		err(EXIT_FAILURE, "malloc()");
 	}
 	return b;
 }



Home | Main Index | Thread Index | Old Index