[refcount] Check for pointer existence
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
eb8378749b
commit
05ef68a4c4
|
@ -26,7 +26,7 @@
|
||||||
#define DO_RCNT(type, prefix, dtor) \
|
#define DO_RCNT(type, prefix, dtor) \
|
||||||
static inline void prefix##_unref(type **item) \
|
static inline void prefix##_unref(type **item) \
|
||||||
{ \
|
{ \
|
||||||
if(--(*item)->refcount <= 0) \
|
if(*item && --(*item)->refcount <= 0) \
|
||||||
dtor(item); \
|
dtor(item); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Reference in New Issue