aboutsummaryrefslogtreecommitdiff
path: root/c/tools/brotli.c
diff options
context:
space:
mode:
authorEugene Kliuchnikov <eustas@google.com>2017-06-30 13:09:50 +0200
committerGitHub <noreply@github.com>2017-06-30 13:09:50 +0200
commit1becbbf231c148d9754cc3a6085929abe920a54a (patch)
tree003921b535c09cb1e599b3bb0aa99cd819d62c47 /c/tools/brotli.c
parent58f5c37f3b5b07f3455a27671bdc48fd2e37cd54 (diff)
downloadbrotli-1becbbf231c148d9754cc3a6085929abe920a54a.zip
brotli-1becbbf231c148d9754cc3a6085929abe920a54a.tar.gz
brotli-1becbbf231c148d9754cc3a6085929abe920a54a.tar.bz2
Update (#569)
* add misssing fclose in `brotli.c` * add basic tests for python `Decompressor` type * minor lint fixes in `_brotli.cc`
Diffstat (limited to 'c/tools/brotli.c')
-rwxr-xr-xc/tools/brotli.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/c/tools/brotli.c b/c/tools/brotli.c
index 3cf6297..637e94e 100755
--- a/c/tools/brotli.c
+++ b/c/tools/brotli.c
@@ -553,12 +553,14 @@ static BROTLI_BOOL ReadDictionary(Context* context) {
if (file_size_64 == -1) {
fprintf(stderr, "could not get size of dictionary file [%s]",
PrintablePath(context->dictionary_path));
+ fclose(f);
return BROTLI_FALSE;
}
if (file_size_64 > kMaxDictionarySize) {
fprintf(stderr, "dictionary [%s] is larger than maximum allowed: %d\n",
PrintablePath(context->dictionary_path), kMaxDictionarySize);
+ fclose(f);
return BROTLI_FALSE;
}
context->dictionary_size = (size_t)file_size_64;
@@ -566,6 +568,7 @@ static BROTLI_BOOL ReadDictionary(Context* context) {
buffer = (uint8_t*)malloc(context->dictionary_size);
if (!buffer) {
fprintf(stderr, "could not read dictionary: out of memory\n");
+ fclose(f);
return BROTLI_FALSE;
}
bytes_read = fread(buffer, sizeof(uint8_t), context->dictionary_size, f);
@@ -573,6 +576,7 @@ static BROTLI_BOOL ReadDictionary(Context* context) {
free(buffer);
fprintf(stderr, "failed to read dictionary [%s]: %s\n",
PrintablePath(context->dictionary_path), strerror(errno));
+ fclose(f);
return BROTLI_FALSE;
}
fclose(f);