summaryrefslogtreecommitdiff
path: root/ar.c
diff options
context:
space:
mode:
authorMatt Kraai2000-09-13 02:46:14 +0000
committerMatt Kraai2000-09-13 02:46:14 +0000
commit322ae93a5e0b78b65831f9fd87fd456eb84d21a1 (patch)
tree5b967e1d873ff6eff8296bf9fda73825f0c55884 /ar.c
parentb89075298edf0a471b9046b1f3c8a936e18ead20 (diff)
downloadbusybox-322ae93a5e0b78b65831f9fd87fd456eb84d21a1.zip
busybox-322ae93a5e0b78b65831f9fd87fd456eb84d21a1.tar.gz
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.
Diffstat (limited to 'ar.c')
-rw-r--r--ar.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ar.c b/ar.c
index d82763d..241c1fa 100644
--- a/ar.c
+++ b/ar.c
@@ -246,7 +246,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct)
headerL_t *list;
off_t initialOffset;
- list = (headerL_t *) malloc(sizeof(headerL_t));
+ list = (headerL_t *) xmalloc(sizeof(headerL_t));
initialOffset=lseek(srcFd, 0, SEEK_CUR);
if (checkArMagic(srcFd)==TRUE)
ar=TRUE;
@@ -258,7 +258,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct)
if (tar==TRUE) {
while(readTarHeader(srcFd, list)==TRUE) {
off_t tarOffset;
- list->next = (headerL_t *) malloc(sizeof(headerL_t));
+ list->next = (headerL_t *) xmalloc(sizeof(headerL_t));
*list->next = *head;
*head = *list;
@@ -282,7 +282,7 @@ static headerL_t *getHeaders(int srcFd, headerL_t *head, int funct)
if (readArEntry(srcFd, list) == FALSE)
return(head);
}
- list->next = (headerL_t *) malloc(sizeof(headerL_t));
+ list->next = (headerL_t *) xmalloc(sizeof(headerL_t));
*list->next = *head;
*head = *list;
/* recursive check for sub-archives */
@@ -349,9 +349,9 @@ extern int ar_main(int argc, char **argv)
return (FALSE);
}
optind++;
- entry = (headerL_t *) malloc(sizeof(headerL_t));
- header = (headerL_t *) malloc(sizeof(headerL_t));
- extractList = (headerL_t *) malloc(sizeof(headerL_t));
+ entry = (headerL_t *) xmalloc(sizeof(headerL_t));
+ header = (headerL_t *) xmalloc(sizeof(headerL_t));
+ extractList = (headerL_t *) xmalloc(sizeof(headerL_t));
header = getHeaders(srcFd, header, funct);
/* find files to extract or display */
@@ -359,7 +359,7 @@ extern int ar_main(int argc, char **argv)
/* only handle specified files */
while(optind < argc) {
if ( (entry = findEntry(header, argv[optind])) != NULL) {
- entry->next = (headerL_t *) malloc(sizeof(headerL_t));
+ entry->next = (headerL_t *) xmalloc(sizeof(headerL_t));
*entry->next = *extractList;
*extractList = *entry;
}