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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 15:58:22 +0000 (11:58 -0400)
commit48894eb201d7bec26a3eb08c154e055e231b9097
tree424986c1a53739740ca60f2e7d07c4f71763de13
parent4b6f661c07a39c85713b66af589aea2618c70b21
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.024426 seconds and 4 git commands to generate.