diff --git a/modules/rtpproxy-ng/bencode.c b/modules/rtpproxy-ng/bencode.c index 0bf69cc4c..b0e31f41e 100644 --- a/modules/rtpproxy-ng/bencode.c +++ b/modules/rtpproxy-ng/bencode.c @@ -6,7 +6,6 @@ #include #include "bencode.h" -#include "../../mem/mem.h" /* set to 0 for alloc debugging, e.g. through valgrind */ #define BENCODE_MIN_BUFFER_PIECE_LEN 512 diff --git a/modules/rtpproxy-ng/bencode.h b/modules/rtpproxy-ng/bencode.h index 39b33c026..5814663f4 100644 --- a/modules/rtpproxy-ng/bencode.h +++ b/modules/rtpproxy-ng/bencode.h @@ -3,11 +3,18 @@ #include #include -#include "../../mem/mem.h" -#ifndef BENCODE_MALLOC -#define BENCODE_MALLOC pkg_malloc -#define BENCODE_FREE pkg_free +#if defined(PKG_MALLOC) || defined(pkg_malloc) +# include "../../mem/mem.h" +# ifndef BENCODE_MALLOC +# define BENCODE_MALLOC pkg_malloc +# define BENCODE_FREE pkg_free +# endif +#else +# ifndef BENCODE_MALLOC +# define BENCODE_MALLOC malloc +# define BENCODE_FREE free +# endif #endif struct bencode_buffer;