htp: add HTPCalloc wrapper

pull/1886/merge
Victor Julien 10 years ago
parent a1a0acf8a8
commit 77f67062de

@ -121,6 +121,23 @@ void *HTPMalloc(size_t size)
return ptr;
}
void *HTPCalloc(size_t n, size_t size)
{
void *ptr = NULL;
if (HTPCheckMemcap((uint32_t)(n * size)) == 0)
return NULL;
ptr = SCCalloc(n, size);
if (unlikely(ptr == NULL))
return NULL;
HTPIncrMemuse((uint64_t)(n * size));
return ptr;
}
void *HTPRealloc(void *ptr, size_t orig_size, size_t size)
{
void *rptr = NULL;

@ -19,6 +19,7 @@
void HTPParseMemcap();
void *HTPMalloc(size_t size);
void *HTPCalloc(size_t n, size_t size);
void *HTPRealloc(void *ptr, size_t orig_size, size_t size);
void HTPFree(void *ptr, size_t size);

Loading…
Cancel
Save