Annotation of /trunk/eject/patches/eject-2.1.5-xmalloc.patch
Parent Directory | Revision Log
Revision 903 -
(hide annotations)
(download)
Fri Oct 16 16:19:38 2009 UTC (14 years, 11 months ago) by niro
File size: 654 byte(s)
Fri Oct 16 16:19:38 2009 UTC (14 years, 11 months ago) by niro
File size: 654 byte(s)
-added several fixed
1 | niro | 903 | Make sure the malloc's work. |
2 | |||
3 | http://bugs.gentoo.org/91977 | ||
4 | |||
5 | --- eject.c | ||
6 | +++ eject.c | ||
7 | @@ -304,2 +304,11 @@ | ||
8 | |||
9 | +void *xmalloc(size_t size) | ||
10 | +{ | ||
11 | + void *ret = malloc(size); | ||
12 | + if (!ret) { | ||
13 | + fprintf(stderr, _("%s: could not allocate memory\n"), programName); | ||
14 | + exit(1); | ||
15 | + } | ||
16 | + return ret; | ||
17 | +} | ||
18 | |||
19 | @@ -324,3 +333,3 @@ | ||
20 | |||
21 | - buf = (char *) malloc(strlen(name)+14); /* to allow for "/dev/cdroms/ + "0" + null */ | ||
22 | + buf = (char *) xmalloc(strlen(name)+14); /* to allow for "/dev/cdroms/ + "0" + null */ | ||
23 | |||
24 | @@ -794,3 +803,3 @@ | ||
25 | if (status == 0) { | ||
26 | - result = (char *) malloc(strlen(name) + 25); | ||
27 | + result = (char *) xmalloc(strlen(name) + 25); | ||
28 | strcpy(result, name); |