Fix: lib: increment refcount of bt_value_null when copying it
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 15 Aug 2019 15:56:14 +0000 (11:56 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 17 Aug 2019 00:12:13 +0000 (20:12 -0400)
commitd164ff16c5d8d303f2f9f3c295e66fff56a271a7
treeedabb10eba63929c5963da3de5755aa1cd89ce18
parent4778a6c98cdf962ff5ea2de99171783c9b4cfb39
Fix: lib: increment refcount of bt_value_null when copying it

Value copy functions must return a new reference.  This is not done for
bt_value_null_copy, which causes refcount imbalance when a null value
gets copied.  A bug caused by this can be triggered with:

    $ git:(3e3535450850) ✗ LIBBABELTRACE2_INIT_LOG_LEVEL=W ~/build/babeltrace/src/cli/babeltrace2 -c src.ctf.fs --params='yo=null,madame=null,la=null'
    ...
    08-15 11:58:25.070  2757  2757 W LIB/VALUE bt_value_null_instance_release_func@value.c:72 Releasing the null value singleton: addr=0x7f070e1fc8e0
    08-15 11:58:25.070  2757  2757 F LIB/VALUE bt_object_put_ref@object.h:367 Babeltrace 2 library precondition not satisfied; error is:
    08-15 11:58:25.070  2757  2757 F LIB/VALUE bt_object_put_ref@object.h:367 Decrementing a reference count set to 0: addr=0x7f070e1fc8e0, ref-count=0
    08-15 11:58:25.070  2757  2757 F LIB/VALUE bt_object_put_ref@object.h:367 Aborting...

Change-Id: I338e6700201892cbe582719bf349041f316d78d8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1942
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/lib/value.c
This page took 0.026936 seconds and 4 git commands to generate.