diff options
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 18 |
1 files changed, 5 insertions, 13 deletions
@@ -172,9 +172,7 @@ void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) | |||
172 | 172 | ||
173 | i = hash_inode(statbuf->st_ino); | 173 | i = hash_inode(statbuf->st_ino); |
174 | s = name ? strlen(name) : 0; | 174 | s = name ? strlen(name) : 0; |
175 | bucket = malloc(sizeof(ino_dev_hashtable_bucket_t) + s); | 175 | bucket = xmalloc(sizeof(ino_dev_hashtable_bucket_t) + s); |
176 | if (bucket == NULL) | ||
177 | fatalError("Not enough memory."); | ||
178 | bucket->ino = statbuf->st_ino; | 176 | bucket->ino = statbuf->st_ino; |
179 | bucket->dev = statbuf->st_dev; | 177 | bucket->dev = statbuf->st_dev; |
180 | if (name) | 178 | if (name) |
@@ -1003,7 +1001,7 @@ extern int replace_match(char *haystack, char *needle, char *newNeedle, | |||
1003 | if (strcmp(needle, newNeedle) == 0) | 1001 | if (strcmp(needle, newNeedle) == 0) |
1004 | return FALSE; | 1002 | return FALSE; |
1005 | 1003 | ||
1006 | oldhayStack = (char *) malloc((unsigned) (strlen(haystack))); | 1004 | oldhayStack = (char *) xmalloc((unsigned) (strlen(haystack))); |
1007 | while (where != NULL) { | 1005 | while (where != NULL) { |
1008 | foundOne++; | 1006 | foundOne++; |
1009 | strcpy(oldhayStack, haystack); | 1007 | strcpy(oldhayStack, haystack); |
@@ -1364,22 +1362,16 @@ extern pid_t findPidByName( char* pidName) | |||
1364 | #endif /* BB_FEATURE_USE_DEVPS_PATCH */ | 1362 | #endif /* BB_FEATURE_USE_DEVPS_PATCH */ |
1365 | #endif /* BB_KILLALL || ( BB_FEATURE_LINUXRC && ( BB_HALT || BB_REBOOT || BB_POWEROFF )) */ | 1363 | #endif /* BB_KILLALL || ( BB_FEATURE_LINUXRC && ( BB_HALT || BB_REBOOT || BB_POWEROFF )) */ |
1366 | 1364 | ||
1367 | #if defined BB_GUNZIP \ | 1365 | /* this should really be farmed out to libbusybox.a */ |
1368 | || defined BB_GZIP \ | ||
1369 | || defined BB_PRINTF \ | ||
1370 | || defined BB_TAIL | ||
1371 | extern void *xmalloc(size_t size) | 1366 | extern void *xmalloc(size_t size) |
1372 | { | 1367 | { |
1373 | void *cp = malloc(size); | 1368 | void *cp = malloc(size); |
1374 | 1369 | ||
1375 | if (cp == NULL) { | 1370 | if (cp == NULL) |
1376 | errorMsg("out of memory"); | 1371 | fatalError("out of memory"); |
1377 | } | ||
1378 | return cp; | 1372 | return cp; |
1379 | } | 1373 | } |
1380 | 1374 | ||
1381 | #endif /* BB_GUNZIP || BB_GZIP || BB_PRINTF || BB_TAIL */ | ||
1382 | |||
1383 | #if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT) | 1375 | #if (__GLIBC__ < 2) && (defined BB_SYSLOGD || defined BB_INIT) |
1384 | extern int vdprintf(int d, const char *format, va_list ap) | 1376 | extern int vdprintf(int d, const char *format, va_list ap) |
1385 | { | 1377 | { |