Close file descriptors

Signed-off-by: James Ketrenos <james_gitlab@ketrenos.com>
This commit is contained in:
James Ketrenos 2020-01-05 19:22:48 -08:00
parent 4d81ce1aca
commit 78ab17acd8

View File

@ -24,6 +24,7 @@ Face *readFaceDescriptor(int id, char *path) {
return NULL;
}
size_t s = fread(buf, 1, sizeof(buf), f);
fclose(f);
char *p = buf;
buf[s] = 0;
@ -67,7 +68,9 @@ int main(int argc, char *argv[]) {
if (!faceDir) {
printf("Can not open %s\n", buf);
} else {
continue;
}
struct dirent *ent;
while ((ent = readdir(faceDir)) != NULL) {
if (strstr(ent->d_name, ".json") == NULL) {
@ -93,7 +96,7 @@ int main(int argc, char *argv[]) {
}
closedir(faceDir);
}
}
Face *pLink = pChain;
int len = 0;
while (pLink) {