MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mem_done

Function mem_done

freebsd/contrib/zlib/test/infcover.c:200–234  ·  view source on GitHub ↗

release the memory allocation zone -- if there are any surprises, notify */

Source from the content-addressed store, hash-verified

198
199/* release the memory allocation zone -- if there are any surprises, notify */
200local 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

Callers 5

infFunction · 0.85
cover_supportFunction · 0.85
cover_wrapFunction · 0.85
cover_backFunction · 0.85
tryFunction · 0.85

Calls 2

mem_highFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected