diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gzlog.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/gzlog.c b/examples/gzlog.c index b8c2927..b977802 100644 --- a/examples/gzlog.c +++ b/examples/gzlog.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * gzlog.c | 2 | * gzlog.c |
3 | * Copyright (C) 2004, 2008, 2012, 2016 Mark Adler, all rights reserved | 3 | * Copyright (C) 2004, 2008, 2012, 2016, 2019 Mark Adler, all rights reserved |
4 | * For conditions of distribution and use, see copyright notice in gzlog.h | 4 | * For conditions of distribution and use, see copyright notice in gzlog.h |
5 | * version 2.2, 14 Aug 2012 | 5 | * version 2.3, 25 May 2019 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* | 8 | /* |
@@ -756,12 +756,14 @@ local int log_recover(struct log *log, int op) | |||
756 | return -2; | 756 | return -2; |
757 | } | 757 | } |
758 | if ((fd = open(log->path, O_RDONLY, 0)) < 0) { | 758 | if ((fd = open(log->path, O_RDONLY, 0)) < 0) { |
759 | free(data); | ||
759 | log_log(log, op, ".add file read failure"); | 760 | log_log(log, op, ".add file read failure"); |
760 | return -1; | 761 | return -1; |
761 | } | 762 | } |
762 | ret = (size_t)read(fd, data, len) != len; | 763 | ret = (size_t)read(fd, data, len) != len; |
763 | close(fd); | 764 | close(fd); |
764 | if (ret) { | 765 | if (ret) { |
766 | free(data); | ||
765 | log_log(log, op, ".add file read failure"); | 767 | log_log(log, op, ".add file read failure"); |
766 | return -1; | 768 | return -1; |
767 | } | 769 | } |