improved Makefile, fixed potential memory leak at Data_create
This commit is contained in:
parent
86003d2b6a
commit
e7f06285df
5
Makefile
5
Makefile
|
@ -1,7 +1,8 @@
|
|||
VERSION = 1.2.3
|
||||
|
||||
CFLAGS += -O2 -Wall -Wextra -Wshadow -fanalyzer -fsanitize=undefined -rdynamic\
|
||||
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\"\
|
||||
CFLAGS += -O2 -Wall -Wextra -Wshadow -fanalyzer -fsanitize=undefined \
|
||||
-Wno-analyzer-file-leak\
|
||||
-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`
|
||||
LIBS = -pthread -lgumbo -lcurl -lfuse -lcrypto -lexpat
|
||||
|
|
|
@ -605,14 +605,15 @@ static int Data_open(Cache * cf)
|
|||
{
|
||||
char *datafn = path_append(DATA_DIR, cf->path);
|
||||
cf->dfp = fopen(datafn, "r+");
|
||||
FREE(datafn);
|
||||
if (!cf->dfp) {
|
||||
/*
|
||||
* Failed to open the data file
|
||||
*/
|
||||
lprintf(error, "fopen(%s): %s\n", datafn, strerror(errno));
|
||||
FREE(datafn);
|
||||
return -1;
|
||||
}
|
||||
FREE(datafn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -634,7 +635,7 @@ static int Meta_open(Cache * cf)
|
|||
FREE(metafn);
|
||||
return -1;
|
||||
}
|
||||
// FREE(metafn);
|
||||
FREE(metafn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -657,7 +658,7 @@ static void Meta_create(Cache * cf)
|
|||
"cannot close metadata after creation: %s.\n",
|
||||
strerror(errno));
|
||||
}
|
||||
// FREE(metafn);
|
||||
FREE(metafn);
|
||||
}
|
||||
|
||||
int Cache_create(const char *path)
|
||||
|
|
Loading…
Reference in New Issue