summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-12-18 11:57:34 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-12-18 11:57:34 -0600
commite652a786d6a889848e328a7dd141abd767aca1b6 (patch)
treec9b97cb89c8cc07b9314c9f2962ae36927a1538b /res
parent03dab00d1d1c115de6ef56ef065b6bf032a70df7 (diff)
parenta9d6fc571d08de45ac3b9cfb78db9007f7b8ed48 (diff)
Merge "json: Audit ast_json_* usage for thread safety." into 13
Diffstat (limited to 'res')
-rw-r--r--res/res_fax.c4
-rw-r--r--res/res_stasis.c6
-rw-r--r--res/res_stasis_playback.c4
-rw-r--r--res/res_stasis_recording.c4
-rw-r--r--res/stasis/app.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/res/res_fax.c b/res/res_fax.c
index e947c91c1..ef0e27696 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -2028,14 +2028,14 @@ static int report_receive_fax_status(struct ast_channel *chan, const char *filen
fax_bitrate = ast_strdupa(fax_bitrate);
}
- json_object = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s, s: O}",
+ json_object = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s, s: o}",
"type", "receive",
"remote_station_id", S_OR(remote_station_id, ""),
"local_station_id", S_OR(local_station_id, ""),
"fax_pages", S_OR(fax_pages, ""),
"fax_resolution", S_OR(fax_resolution, ""),
"fax_bitrate", S_OR(fax_bitrate, ""),
- "filenames", json_array);
+ "filenames", ast_json_ref(json_array));
if (!json_object) {
return -1;
}
diff --git a/res/res_stasis.c b/res/res_stasis.c
index 1cab8c389..94b037e69 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -150,10 +150,10 @@ static struct ast_json *stasis_start_to_json(struct stasis_message *message,
return NULL;
}
- msg = ast_json_pack("{s: s, s: O, s: O, s: o}",
+ msg = ast_json_pack("{s: s, s: o, s: o, s: o}",
"type", "StasisStart",
- "timestamp", ast_json_object_get(payload->blob, "timestamp"),
- "args", ast_json_object_get(payload->blob, "args"),
+ "timestamp", ast_json_copy(ast_json_object_get(payload->blob, "timestamp")),
+ "args", ast_json_deep_copy(ast_json_object_get(payload->blob, "args")),
"channel", ast_channel_snapshot_to_json(payload->channel, NULL));
if (!msg) {
ast_log(LOG_ERROR, "Failed to pack JSON for StasisStart message\n");
diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index dc6e8f2b8..779dd7755 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -105,9 +105,9 @@ static struct ast_json *playback_to_json(struct stasis_message *message,
return NULL;
}
- return ast_json_pack("{s: s, s: O}",
+ return ast_json_pack("{s: s, s: o}",
"type", type,
- "playback", blob);
+ "playback", ast_json_deep_copy(blob));
}
STASIS_MESSAGE_TYPE_DEFN(stasis_app_playback_snapshot_type,
diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index 50e0697b1..392d92c8e 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -91,9 +91,9 @@ static struct ast_json *recording_to_json(struct stasis_message *message,
return NULL;
}
- return ast_json_pack("{s: s, s: O}",
+ return ast_json_pack("{s: s, s: o}",
"type", type,
- "recording", blob);
+ "recording", ast_json_deep_copy(blob));
}
STASIS_MESSAGE_TYPE_DEFN(stasis_app_recording_snapshot_type,
diff --git a/res/stasis/app.c b/res/stasis/app.c
index 353918241..4e18aa5ae 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -610,11 +610,11 @@ static int message_received_handler(const char *endpoint_id, struct ast_json *js
return -1;
}
- app_send(app, ast_json_pack("{s: s, s: o, s: o, s: O}",
+ app_send(app, ast_json_pack("{s: s, s: o, s: o, s: o}",
"type", "TextMessageReceived",
"timestamp", ast_json_timeval(ast_tvnow(), NULL),
"endpoint", json_endpoint,
- "message", json_msg));
+ "message", ast_json_ref(json_msg)));
return 0;
}