diff --git a/common/refcount.h b/common/refcount.h index 1eb56c796..18f4b109e 100644 --- a/common/refcount.h +++ b/common/refcount.h @@ -26,7 +26,7 @@ #define DO_RCNT(type, prefix, dtor) \ static inline void prefix##_unref(type **item) \ { \ - if(--(*item)->refcount <= 0) \ + if(*item && --(*item)->refcount <= 0) \ dtor(item); \ } \ \