release the memory allocation zone -- if there are any surprises, notify */
| 198 | |
| 199 | /* release the memory allocation zone -- if there are any surprises, notify */ |
| 200 | local void mem_done(z_stream *strm, char *prefix) |
| 201 | { |
| 202 | int count = 0; |
| 203 | struct mem_item *item, *next; |
| 204 | struct mem_zone *zone = strm->opaque; |
| 205 | |
| 206 | /* show high water mark */ |
| 207 | mem_high(strm, prefix); |
| 208 | |
| 209 | /* free leftover allocations and item structures, if any */ |
| 210 | item = zone->first; |
| 211 | while (item != NULL) { |
| 212 | free(item->ptr); |
| 213 | next = item->next; |
| 214 | free(item); |
| 215 | item = next; |
| 216 | count++; |
| 217 | } |
| 218 | |
| 219 | /* issue alerts about anything unexpected */ |
| 220 | if (count || zone->total) |
| 221 | fprintf(stderr, "** %s: %lu bytes in %d blocks not freed\n", |
| 222 | prefix, zone->total, count); |
| 223 | if (zone->notlifo) |
| 224 | fprintf(stderr, "** %s: %d frees not LIFO\n", prefix, zone->notlifo); |
| 225 | if (zone->rogue) |
| 226 | fprintf(stderr, "** %s: %d frees not recognized\n", |
| 227 | prefix, zone->rogue); |
| 228 | |
| 229 | /* free the zone and delete from the stream */ |
| 230 | free(zone); |
| 231 | strm->opaque = Z_NULL; |
| 232 | strm->zalloc = Z_NULL; |
| 233 | strm->zfree = Z_NULL; |
| 234 | } |
| 235 | |
| 236 | /* -- inflate test routines -- */ |
| 237 |
no test coverage detected