Due to pointer size mishandling, the pool code could consider a
block of memory inside the 'preallocated' block. It would then not
free the block.
# Checks for libraries.
# Checks for header files.
+ AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([arpa/inet.h assert.h ctype.h errno.h fcntl.h inttypes.h])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([limits.h netdb.h netinet/in.h poll.h sched.h signal.h])
#include <stdio.h>
#endif
+#if HAVE_STDDEF_H
+#include <stddef.h>
+#endif
+
#if HAVE_STDINT_h
#include <stdint.h>
#endif
/**
* \brief Check if data is preallocated
- * \retval 0 or -1 if not inside */
+ * \retval 0 if not inside the prealloc'd block, 1 if inside */
static int PoolDataPreAllocated(Pool *p, void *data)
{
- int delta = data - p->data_buffer;
+ ptrdiff_t delta = data - p->data_buffer;
if ((delta < 0) || (delta > p->data_buffer_size)) {
return 0;
}