From: jbj Date: Wed, 20 Oct 1999 21:47:42 +0000 (+0000) Subject: Use xmalloc/xrealloc/xstrdup. X-Git-Tag: rpm-4.4-release~2536 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6698260f453b3f9418a8d7fdbbd6d764ef99606;p=platform%2Fupstream%2Frpm.git Use xmalloc/xrealloc/xstrdup. CVS patchset: 3388 CVS date: 1999/10/20 21:47:42 --- 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)); }