diff --git a/daemon/bencode.h b/daemon/bencode.h index f36eb3d4d..5814663f4 100644 --- a/daemon/bencode.h +++ b/daemon/bencode.h @@ -4,9 +4,17 @@ #include #include -#ifndef BENCODE_MALLOC -#define BENCODE_MALLOC malloc -#define BENCODE_FREE 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;