Skip to content

Commit

Permalink
mem: trigger error when setting pkg allocator with sys malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Apr 19, 2019
1 parent 3b196a9 commit 3b83d36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions mem/mem.c
Expand Up @@ -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);
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions mem/mem.h
Expand Up @@ -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;

Expand Down

0 comments on commit 3b83d36

Please sign in to comment.