diff --git a/src/core/object.c b/src/core/object.c
index 177ac4c3ada9a76009805187d0a0cd4eda322b9e..dfa06551cb62c1353b59d827ea5333c8e7f30187 100644 (file)
--- a/src/core/object.c
+++ b/src/core/object.c
#include <stdlib.h>
#include <string.h>
+#include <strings.h>
/*
* private types
{
sdb_object_t *obj;
- if (type.size <= sizeof(sdb_object_t))
+ if (type.size < sizeof(sdb_object_t))
return NULL;
obj = malloc(type.size);
if (obj->ref_cnt > 0)
return;
+ /* we'd access free'd memory in case ref_cnt < 0 */
+ assert(! obj->ref_cnt);
+
if (obj->type.destroy)
obj->type.destroy(obj);