123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- #ifdef HAVE_CONFIG_H
- #include <config.h>
- #endif
- #include "alloc.h"
- #include "crypto_kernel.h"
- srtp_debug_module_t srtp_mod_alloc = {
- 0,
- "alloc"
- };
- #if defined(HAVE_STDLIB_H)
- void *srtp_crypto_alloc(size_t size)
- {
- void *ptr;
- if (!size) {
- return NULL;
- }
- ptr = calloc(1, size);
- if (ptr) {
- debug_print(srtp_mod_alloc, "(location: %p) allocated", ptr);
- } else {
- debug_print(srtp_mod_alloc, "allocation failed (asked for %zu bytes)\n",
- size);
- }
- return ptr;
- }
- void srtp_crypto_free(void *ptr)
- {
- debug_print(srtp_mod_alloc, "(location: %p) freed", ptr);
- free(ptr);
- }
- #else
- #error no memory allocation defined yet
- #endif
|