Meta_create() now calls fclose itself

This commit is contained in:
Fufu Fang 2021-09-01 12:19:20 +01:00
parent 464c8e4863
commit 86003d2b6a
3 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
VERSION = 1.2.3
CFLAGS += -O2 -Wall -Wextra -Wshadow -fsanitize=undefined -rdynamic\
CFLAGS += -O2 -Wall -Wextra -Wshadow -fanalyzer -fsanitize=undefined -rdynamic\
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\"\
`pkg-config --cflags-only-I gumbo libcurl fuse uuid expat`
LDFLAGS += `pkg-config --libs-only-L gumbo libcurl fuse uuid expat`

View File

@ -634,7 +634,7 @@ static int Meta_open(Cache * cf)
FREE(metafn);
return -1;
}
FREE(metafn);
// FREE(metafn);
return 0;
}
@ -652,7 +652,12 @@ static void Meta_create(Cache * cf)
*/
lprintf(fatal, "fopen(%s): %s\n", metafn, strerror(errno));
}
FREE(metafn);
if (fclose(cf->mfp)) {
lprintf(error,
"cannot close metadata after creation: %s.\n",
strerror(errno));
}
// FREE(metafn);
}
int Cache_create(const char *path)
@ -683,12 +688,6 @@ int Cache_create(const char *path)
Meta_create(cf);
if (fclose(cf->mfp)) {
lprintf(error,
"cannot close metadata after creation: %s.\n",
strerror(errno));
}
if (Meta_open(cf)) {
Cache_free(cf);
lprintf(error, "cannot open metadata file, %s.\n", fn);

View File

@ -164,6 +164,7 @@ void parse_config_file(char ***argv, int *argc)
}
}
FREE(full_path);
fclose(config);
}
static int