From e6698260f453b3f9418a8d7fdbbd6d764ef99606 Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 20 Oct 1999 21:47:42 +0000 Subject: [PATCH] Use xmalloc/xrealloc/xstrdup. CVS patchset: 3388 CVS date: 1999/10/20 21:47:42 --- lib/fprint.c | 8 ++++---- lib/transaction.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/fprint.c b/lib/fprint.c index 5fcceef..3c5e3b6 100644 --- a/lib/fprint.c +++ b/lib/fprint.c @@ -6,7 +6,7 @@ fingerPrintCache fpCacheCreate(int sizeHint) { fingerPrintCache fpc; - fpc = malloc(sizeof(*fpc)); + fpc = xmalloc(sizeof(*fpc)); fpc->ht = htCreate(sizeHint * 2, sizeof(char *), hashFunctionString, hashEqualityString); return fpc; @@ -75,15 +75,15 @@ static fingerPrint doLookup(fingerPrintCache cache, const char * dirName, if ((cacheHit = cacheContainsDirectory(cache, *buf ? buf : "/"))) { fp.entry = cacheHit; } else if (!stat(*buf ? buf : "/", &sb)) { - newEntry = malloc(sizeof(*fp.entry)); + newEntry = xmalloc(sizeof(*fp.entry)); newEntry->ino = sb.st_ino; newEntry->dev = sb.st_dev; newEntry->isFake = 0; - newEntry->dirName = strdup(*buf ? buf : "/"); + newEntry->dirName = xstrdup(*buf ? buf : "/"); fp.entry = newEntry; /* XXX FIXME: memory leak */ - htAddEntry(cache->ht, strdup(*buf ? buf : "/"), fp.entry); + htAddEntry(cache->ht, xstrdup(*buf ? buf : "/"), fp.entry); } if (fp.entry) { diff --git a/lib/transaction.c b/lib/transaction.c index 2ee6a1c..f3513c5 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -448,7 +448,7 @@ static Header relocateFileList(struct availablePackage * alp, int k; haveRelocatedFile = 1; - newDirList = malloc(sizeof(*newDirList) * (dirCount + 1)); + newDirList = xmalloc(sizeof(*newDirList) * (dirCount + 1)); for (k = 0; k < dirCount; k++) { newDirList[k] = alloca(strlen(dirNames[k]) + 1); strcpy(newDirList[k], dirNames[k]); @@ -456,7 +456,7 @@ static Header relocateFileList(struct availablePackage * alp, free(dirNames); dirNames = newDirList; } else { - dirNames = realloc(dirNames, + dirNames = xrealloc(dirNames, sizeof(*dirNames) * (dirCount + 1)); } -- 2.7.4