Index: src/libs/zbxalgo/hashset.c
===================================================================
--- src/libs/zbxalgo/hashset.c	(revision 43311)
+++ src/libs/zbxalgo/hashset.c	(working copy)
@@ -16,6 +16,7 @@
 ** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
+#include <stddef.h>
 
 #include "common.h"
 #include "log.h"
@@ -168,7 +169,7 @@
 			/* recalculate new slot */
 			slot = hash % hs->num_slots;
 		}
-		if (NULL == (entry = hs->mem_malloc_func(NULL, sizeof(ZBX_HASHSET_ENTRY_T) + size - 1)))
+		if (NULL == (entry = hs->mem_malloc_func(NULL, offsetof(ZBX_HASHSET_ENTRY_T, data) + size)))
 			return NULL;
 
 		memcpy((char *)entry->data + offset, (const char *)data + offset, size - offset);
