From 322ae93a5e0b78b65831f9fd87fd456eb84d21a1 Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Wed, 13 Sep 2000 02:46:14 +0000 Subject: 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. --- archival/ar.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'archival') diff --git a/archival/ar.c b/archival/ar.c index d82763d..241c1fa 100644 --- a/archival/ar.c +++ b/archival/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; } -- cgit v1.1