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;
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) {
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]);
free(dirNames);
dirNames = newDirList;
} else {
- dirNames = realloc(dirNames,
+ dirNames = xrealloc(dirNames,
sizeof(*dirNames) * (dirCount + 1));
}