Fix: call release() when suitable
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 1 Jul 2015 18:58:19 +0000 (20:58 +0200)
committerStanislaw Wadas <s.wadas@samsung.com>
Fri, 3 Jul 2015 14:55:35 +0000 (16:55 +0200)
Change-Id: I56a065b085d0fcb472a314f8796e177751f9c1d9
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
include/uref.h

index d7b09a4948d087205e1de7dec1b735a65208c189..d9f552243255686c5f11a50347b689a1b14aedbd 100644 (file)
@@ -51,6 +51,8 @@ static inline void uref_sub(struct uref *uref, unsigned count)
 {
        assert(uref->refcnt >= count);
        uref->refcnt -= count;
+       if (uref->refcnt == 0 && uref->release)
+               uref->release(uref);
 }
 
 static inline void uref_put(struct uref *uref)