Make json_object_add_value_string() duplicate its 'value' argument
authorBart Van Assche <bvanassche@acm.org>
Sun, 24 May 2020 20:25:37 +0000 (13:25 -0700)
committerBart Van Assche <bvanassche@acm.org>
Sun, 24 May 2020 21:41:36 +0000 (14:41 -0700)
commitc42b48fed60105b4bcd443b9a013548e9e9c43e0
tree933dbf8932b4a052d647e73092f1348e7568f37e
parentd51e4ffa596b617cdb41680b31a4a3895a5307fc
Make json_object_add_value_string() duplicate its 'value' argument

Having some json_object_add_value_string() callers duplicate the 'value'
argument others not is dubious because it can lead to dangling pointers,
e.g. when passing strings to json_object_add_value_string() that live less
long than the created JSON object. See e.g. the 'time_buf' stack array that
is passed by fio_client_json_init() to json_object_add_value_string().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
client.c
json.h
stat.c