MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlMemFree

Function xmlMemFree

ThirdParty/libxml2/vtklibxml2/xmlmemory.c:201–230  ·  view source on GitHub ↗

* xmlMemFree: * @ptr: the memory block pointer * * a free() equivalent, with error checking. */

Source from the content-addressed store, hash-verified

199 * a free() equivalent, with error checking.
200 */
201void
202xmlMemFree(void *ptr)
203{
204 MEMHDR *p;
205
206 if (ptr == NULL)
207 return;
208
209 if (ptr == (void *) -1) {
210 fprintf(stderr, "xmlMemFree: Pointer from freed area\n");
211 return;
212 }
213
214 p = CLIENT_2_HDR(ptr);
215 if (p->mh_tag != MEMTAG) {
216 fprintf(stderr, "xmlMemFree: Tag error\n");
217 return;
218 }
219 p->mh_tag = ~MEMTAG;
220 memset(ptr, -1, p->mh_size);
221
222 xmlMutexLock(&xmlMemMutex);
223 debugMemSize -= p->mh_size;
224 debugMemBlocks--;
225 xmlMutexUnlock(&xmlMemMutex);
226
227 free(p);
228
229 return;
230}
231
232/**
233 * xmlMemStrdupLoc:

Callers 3

myFreeFuncFunction · 0.85
myMallocFuncFunction · 0.85
myStrdupFuncFunction · 0.85

Calls 3

fprintfFunction · 0.85
xmlMutexLockFunction · 0.85
xmlMutexUnlockFunction · 0.85

Tested by

no test coverage detected