Validate ref count opt-in in bt_ref_get
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 28 Oct 2016 21:27:09 +0000 (17:27 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:06 +0000 (14:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/ref-internal.h

index 8578de97b2ec1808eded8e9887961c1e3e7f4644..3a8b39f4136139807ba6c207b77725fe8554a499 100644 (file)
@@ -50,9 +50,12 @@ static inline
 void bt_ref_get(struct bt_ref *ref)
 {
        assert(ref);
-       ref->count++;
-       /* Overflow check. */
-       assert(ref->count);
+       if (ref->release) {
+               /* Object has opted-in reference counting. */
+               ref->count++;
+               /* Overflow check. */
+               assert(ref->count);
+       }
 }
 
 static inline
This page took 0.028054 seconds and 4 git commands to generate.