Fix: cli: increment bt_value_null ref count when returning null value
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 15 Aug 2019 15:24:24 +0000 (11:24 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 17 Aug 2019 00:12:13 +0000 (20:12 -0400)
commit4778a6c98cdf962ff5ea2de99171783c9b4cfb39
treedcee552e61fc8dbd7f38f370c21a35bc16533fcb
parentc7d2f7b637ef8533b9d0fdbe9d84828693ff99e4
Fix: cli: increment bt_value_null ref count when returning null value

The ini_parse_value function returns a new reference to a value.
When return a null value, it needs to acquire a new reference to
bt_value_null to account for that.

A crash can be triggered because of this bug with:

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

Change-Id: I6748fd9d8a7ba89728f0e4ddb9ea62bf423fdc91
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1941
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/cli/babeltrace2-cfg-cli-params-arg.c
This page took 0.034516 seconds and 4 git commands to generate.