diff options
author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-09-13 02:46:14 +0000 |
---|---|---|
committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-09-13 02:46:14 +0000 |
commit | 9f559aa7068b38ba510640873a58953e94139248 (patch) | |
tree | 5b967e1d873ff6eff8296bf9fda73825f0c55884 /ar.c | |
parent | 033cbe20a6a0389007a333a4fdf1dc87d8eb368e (diff) | |
download | busybox-w32-9f559aa7068b38ba510640873a58953e94139248.tar.gz busybox-w32-9f559aa7068b38ba510640873a58953e94139248.tar.bz2 busybox-w32-9f559aa7068b38ba510640873a58953e94139248.zip |
Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of
segfaulting or handling errors the same way themselves.
git-svn-id: svn://busybox.net/trunk/busybox@1039 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'ar.c')
-rw-r--r-- | ar.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -246,7 +246,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct) | |||
246 | headerL_t *list; | 246 | headerL_t *list; |
247 | off_t initialOffset; | 247 | off_t initialOffset; |
248 | 248 | ||
249 | list = (headerL_t *) malloc(sizeof(headerL_t)); | 249 | list = (headerL_t *) xmalloc(sizeof(headerL_t)); |
250 | initialOffset=lseek(srcFd, 0, SEEK_CUR); | 250 | initialOffset=lseek(srcFd, 0, SEEK_CUR); |
251 | if (checkArMagic(srcFd)==TRUE) | 251 | if (checkArMagic(srcFd)==TRUE) |
252 | ar=TRUE; | 252 | ar=TRUE; |
@@ -258,7 +258,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct) | |||
258 | if (tar==TRUE) { | 258 | if (tar==TRUE) { |
259 | while(readTarHeader(srcFd, list)==TRUE) { | 259 | while(readTarHeader(srcFd, list)==TRUE) { |
260 | off_t tarOffset; | 260 | off_t tarOffset; |
261 | list->next = (headerL_t *) malloc(sizeof(headerL_t)); | 261 | list->next = (headerL_t *) xmalloc(sizeof(headerL_t)); |
262 | *list->next = *head; | 262 | *list->next = *head; |
263 | *head = *list; | 263 | *head = *list; |
264 | 264 | ||
@@ -282,7 +282,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct) | |||
282 | if (readArEntry(srcFd, list) == FALSE) | 282 | if (readArEntry(srcFd, list) == FALSE) |
283 | return(head); | 283 | return(head); |
284 | } | 284 | } |
285 | list->next = (headerL_t *) malloc(sizeof(headerL_t)); | 285 | list->next = (headerL_t *) xmalloc(sizeof(headerL_t)); |
286 | *list->next = *head; | 286 | *list->next = *head; |
287 | *head = *list; | 287 | *head = *list; |
288 | /* recursive check for sub-archives */ | 288 | /* recursive check for sub-archives */ |
@@ -349,9 +349,9 @@ extern int ar_main(int argc, char **argv) | |||
349 | return (FALSE); | 349 | return (FALSE); |
350 | } | 350 | } |
351 | optind++; | 351 | optind++; |
352 | entry = (headerL_t *) malloc(sizeof(headerL_t)); | 352 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); |
353 | header = (headerL_t *) malloc(sizeof(headerL_t)); | 353 | header = (headerL_t *) xmalloc(sizeof(headerL_t)); |
354 | extractList = (headerL_t *) malloc(sizeof(headerL_t)); | 354 | extractList = (headerL_t *) xmalloc(sizeof(headerL_t)); |
355 | 355 | ||
356 | header = getHeaders(srcFd, header, funct); | 356 | header = getHeaders(srcFd, header, funct); |
357 | /* find files to extract or display */ | 357 | /* find files to extract or display */ |
@@ -359,7 +359,7 @@ extern int ar_main(int argc, char **argv) | |||
359 | /* only handle specified files */ | 359 | /* only handle specified files */ |
360 | while(optind < argc) { | 360 | while(optind < argc) { |
361 | if ( (entry = findEntry(header, argv[optind])) != NULL) { | 361 | if ( (entry = findEntry(header, argv[optind])) != NULL) { |
362 | entry->next = (headerL_t *) malloc(sizeof(headerL_t)); | 362 | entry->next = (headerL_t *) xmalloc(sizeof(headerL_t)); |
363 | *entry->next = *extractList; | 363 | *entry->next = *extractList; |
364 | *extractList = *entry; | 364 | *extractList = *entry; |
365 | } | 365 | } |