diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/zran.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/zran.c b/examples/zran.c index 617a130..278f9ad 100644 --- a/examples/zran.c +++ b/examples/zran.c | |||
@@ -1,7 +1,12 @@ | |||
1 | /* zran.c -- example of zlib/gzip stream indexing and random access | 1 | /* zran.c -- example of zlib/gzip stream indexing and random access |
2 | * Copyright (C) 2005 Mark Adler | 2 | * Copyright (C) 2005, 2012 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | Version 1.0 29 May 2005 Mark Adler */ | 4 | Version 1.1 29 Sep 2012 Mark Adler */ |
5 | |||
6 | /* Version History: | ||
7 | 1.0 29 May 2005 First version | ||
8 | 1.1 29 Sep 2012 Fix memory reallocation error | ||
9 | */ | ||
5 | 10 | ||
6 | /* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() | 11 | /* Illustrate the use of Z_BLOCK, inflatePrime(), and inflateSetDictionary() |
7 | for random access of a compressed file. A file containing a zlib or gzip | 12 | for random access of a compressed file. A file containing a zlib or gzip |
@@ -221,7 +226,7 @@ local int build_index(FILE *in, off_t span, struct access **built) | |||
221 | 226 | ||
222 | /* clean up and return index (release unused entries in list) */ | 227 | /* clean up and return index (release unused entries in list) */ |
223 | (void)inflateEnd(&strm); | 228 | (void)inflateEnd(&strm); |
224 | index = realloc(index, sizeof(struct point) * index->have); | 229 | index->list = realloc(index->list, sizeof(struct point) * index->have); |
225 | index->size = index->have; | 230 | index->size = index->have; |
226 | *built = index; | 231 | *built = index; |
227 | return index->size; | 232 | return index->size; |