blob: f609da19d05f3832fa025c3efe051d5ff6bb8f7a [file] [log] [blame]
Make sure the malloc's work.
http://bugs.gentoo.org/91977
--- eject.c
+++ eject.c
@@ -304,2 +304,11 @@
+void *xmalloc(size_t size)
+{
+ void *ret = malloc(size);
+ if (!ret) {
+ fprintf(stderr, _("%s: could not allocate memory\n"), programName);
+ exit(1);
+ }
+ return ret;
+}
@@ -324,3 +333,3 @@
- buf = (char *) malloc(strlen(name)+14); /* to allow for "/dev/cdroms/ + "0" + null */
+ buf = (char *) xmalloc(strlen(name)+14); /* to allow for "/dev/cdroms/ + "0" + null */
@@ -794,3 +803,3 @@
if (status == 0) {
- result = (char *) malloc(strlen(name) + 25);
+ result = (char *) xmalloc(strlen(name) + 25);
strcpy(result, name);