diff --git a/src/ckpool.c b/src/ckpool.c index 5a15b590..bef14365 100644 --- a/src/ckpool.c +++ b/src/ckpool.c @@ -810,6 +810,7 @@ static void launch_process(proc_instance_t *pi) struct sigaction handler; int ret; + json_set_alloc_funcs(json_ckalloc, free); launch_logger(pi); handler.sa_handler = &childsighandler; handler.sa_flags = 0; @@ -1260,6 +1261,7 @@ int main(int argc, char **argv) /* Make significant floating point errors fatal to avoid subtle bugs being missed */ feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW ); + json_set_alloc_funcs(json_ckalloc, free); global_ckp = &ckp; memset(&ckp, 0, sizeof(ckp)); diff --git a/src/libckpool.c b/src/libckpool.c index 12db182f..5d992e2e 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -1270,6 +1270,11 @@ void *_ckalloc(size_t len, const char *file, const char *func, const int line) return ptr; } +void *json_ckalloc(size_t size) +{ + return _ckalloc(size, __FILE__, __func__, __LINE__); +} + void *_ckzalloc(size_t len, const char *file, const char *func, const int line) { int backoff = 1; diff --git a/src/libckpool.h b/src/libckpool.h index ac865046..a52628fe 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -489,6 +489,7 @@ void align_len(size_t *len); void realloc_strcat(char **ptr, const char *s); void trail_slash(char **buf); void *_ckalloc(size_t len, const char *file, const char *func, const int line); +void *json_ckalloc(size_t size); void *_ckzalloc(size_t len, const char *file, const char *func, const int line); void _dealloc(void **ptr); extern const int hex2bin_tbl[];