diff --git a/mem/mem.c b/mem/mem.c index 83facfccfe5..38a889ae914 100644 --- a/mem/mem.c +++ b/mem/mem.c @@ -60,6 +60,7 @@ unsigned long (*gen_pkg_get_frags)(void *blk); int set_pkg_mm(const char *mm_name) { +#ifdef PKG_MALLOC #ifdef INLINE_ALLOC LM_NOTICE("this is an inlined allocator build (see opensips -V), " "cannot set a custom pkg allocator (%s)\n", mm_name); @@ -70,6 +71,10 @@ int set_pkg_mm(const char *mm_name) return -1; return 0; +#else + LM_ERR("cannot change pkg allocator when system malloc is used!\n"); + return -1; +#endif } int init_pkg_mallocs(void) diff --git a/mem/mem.h b/mem/mem.h index fc77e3b67e6..0d30fe15a76 100644 --- a/mem/mem.h +++ b/mem/mem.h @@ -30,11 +30,12 @@ #include "../dprint.h" #include "mem_funcs.h" -#ifdef PKG_MALLOC -#include "common.h" int set_pkg_mm(const char *mm_name); +#ifdef PKG_MALLOC +#include "common.h" + extern char *mem_pool; extern enum osips_mm mem_allocator_pkg;