]> git.ipfire.org Git - thirdparty/asterisk.git/commit
json: Audit ast_json_* usage for thread safety. 28/1828/1
authorJoshua Colp <jcolp@digium.com>
Mon, 14 Dec 2015 18:04:15 +0000 (14:04 -0400)
committerJoshua Colp <jcolp@digium.com>
Wed, 16 Dec 2015 21:17:30 +0000 (17:17 -0400)
commita9d6fc571d08de45ac3b9cfb78db9007f7b8ed48
tree349549e7e53d01e15d9eaeaeec9324e2fbef740e
parent280adca0a55f5fa75dc562ded5a2daf9df6a6184
json: Audit ast_json_* usage for thread safety.

The JSON library Asterisk uses, jansson, is not thread
safe for us in a few ways. To help with this wrappers for JSON
object reference count increasing and decreasing were added
which use a global lock to ensure they don't clobber over
each other. This does not extend to reference count manipulation
within the jansson library itself. This means you can't safely
use the object borrowing specifier (O) in ast_json_pack and
you can't share JSON instances between objects.

This change removes uses of the O specifier and replaces them
with the o specifier and an explicit ast_json_ref. Some cases
of instance sharing have also been removed.

ASTERISK-25601 #close

Change-Id: I06550d8b0cc1bfeb56cab580a4e608ae4f1ec7d1
main/aoc.c
main/loader.c
main/rtp_engine.c
main/stasis.c
main/stasis_channels.c
res/res_fax.c
res/res_stasis.c
res/res_stasis_playback.c
res/res_stasis_recording.c
res/stasis/app.c