summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_voicemail.c3
-rw-r--r--funcs/func_callerid.c18
-rw-r--r--main/cel.c4
-rw-r--r--main/rtp_engine.c60
4 files changed, 44 insertions, 41 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index c080bfee9..4a0dacc05 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5373,6 +5373,7 @@ plain_message:
static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format, char *attach, char *greeting_attachment, char *mailbox, char *bound, char *filename, int last, int msgnum)
{
char fname[PATH_MAX] = "";
+ char sox_gain_tmpdir[PATH_MAX];
char *file_to_delete = NULL, *dir_to_delete = NULL;
int res;
@@ -5382,7 +5383,6 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format,
/* This 'while' loop will only execute once. We use it so that we can 'break' */
while (vmu->volgain < -.001 || vmu->volgain > .001) {
char tmpdir[PATH_MAX];
- char sox_gain_tmpdir[PATH_MAX];
create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
@@ -13212,6 +13212,7 @@ static void mwi_sub_event_cb(struct stasis_subscription_change *change)
}
if (separate_mailbox(ast_strdupa(stasis_topic_name(change->topic)), &mailbox, &context)) {
+ ast_free(mwist);
return;
}
diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c
index 4db985ecb..aabd70fea 100644
--- a/funcs/func_callerid.c
+++ b/funcs/func_callerid.c
@@ -980,7 +980,7 @@ static int callerpres_write(struct ast_channel *chan, const char *cmd, char *dat
static int callerid_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
char *parms;
- struct ast_party_members member;
+ struct ast_party_members member = { 0, };
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(member); /*!< Member name */
AST_APP_ARG(cid); /*!< Optional caller id to parse instead of from the channel. */
@@ -1137,8 +1137,8 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
enum ID_FIELD_STATUS status;
char *val;
char *parms;
- struct ast_party_func_args args;
- struct ast_party_members member;
+ struct ast_party_func_args args = { 0, };
+ struct ast_party_members member = { 0, };
if (!value || !chan) {
return -1;
@@ -1293,7 +1293,7 @@ static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
*/
static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
- struct ast_party_members member;
+ struct ast_party_members member = { 0, };
char *read_what;
enum ID_FIELD_STATUS status;
@@ -1361,8 +1361,8 @@ static int connectedline_write(struct ast_channel *chan, const char *cmd, char *
char *val;
char *parms;
void (*set_it)(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update);
- struct ast_party_func_args args;
- struct ast_party_members member;
+ struct ast_party_func_args args = { 0, };
+ struct ast_party_members member = { 0, };
struct ast_flags opts;
char *opt_args[CONNECTED_LINE_OPT_ARG_ARRAY_SIZE];
enum ID_FIELD_STATUS status;
@@ -1466,7 +1466,7 @@ static int connectedline_write(struct ast_channel *chan, const char *cmd, char *
*/
static int redirecting_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
- struct ast_party_members member;
+ struct ast_party_members member = { 0, };
char *read_what;
const struct ast_party_redirecting *ast_redirecting;
enum ID_FIELD_STATUS status;
@@ -1603,8 +1603,8 @@ static int redirecting_write(struct ast_channel *chan, const char *cmd, char *da
char *val;
char *parms;
void (*set_it)(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update);
- struct ast_party_func_args args;
- struct ast_party_members member;
+ struct ast_party_func_args args = { 0, };
+ struct ast_party_members member = { 0, };
struct ast_flags opts;
char *opt_args[REDIRECTING_OPT_ARG_ARRAY_SIZE];
diff --git a/main/cel.c b/main/cel.c
index d46f185cf..24d7faa85 100644
--- a/main/cel.c
+++ b/main/cel.c
@@ -1837,9 +1837,9 @@ void ast_cel_publish_event(struct ast_channel *chan,
struct ast_json *cel_blob;
struct stasis_message *message;
- cel_blob = ast_json_pack("{s: i, s: O}",
+ cel_blob = ast_json_pack("{s: i, s: o}",
"event_type", event_type,
- "event_details", blob);
+ "event_details", ast_json_ref(blob));
message = ast_channel_blob_create_from_cache(ast_channel_uniqueid(chan), cel_generic_type(), cel_blob);
if (message) {
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index b12761bc4..67349cefa 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -2501,10 +2501,10 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
const struct stasis_message_sanitizer *sanitize)
{
struct rtcp_message_payload *payload = stasis_message_data(msg);
- RAII_VAR(struct ast_json *, json_rtcp_report, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, json_rtcp_report_blocks, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, json_rtcp_sender_info, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, json_channel, NULL, ast_json_unref);
+ struct ast_json *json_rtcp_report = NULL;
+ struct ast_json *json_rtcp_report_blocks;
+ struct ast_json *json_rtcp_sender_info = NULL;
+ struct ast_json *json_channel = NULL;
int i;
json_rtcp_report_blocks = ast_json_array_create();
@@ -2515,20 +2515,19 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
for (i = 0; i < payload->report->reception_report_count && payload->report->report_block[i]; i++) {
struct ast_json *json_report_block;
char str_lsr[32];
+
snprintf(str_lsr, sizeof(str_lsr), "%u", payload->report->report_block[i]->lsr);
json_report_block = ast_json_pack("{s: i, s: i, s: i, s: i, s: i, s: s, s: i}",
- "source_ssrc", payload->report->report_block[i]->source_ssrc,
- "fraction_lost", payload->report->report_block[i]->lost_count.fraction,
- "packets_lost", payload->report->report_block[i]->lost_count.packets,
- "highest_seq_no", payload->report->report_block[i]->highest_seq_no,
- "ia_jitter", payload->report->report_block[i]->ia_jitter,
- "lsr", str_lsr,
- "dlsr", payload->report->report_block[i]->dlsr);
- if (!json_report_block) {
- return NULL;
- }
-
- if (ast_json_array_append(json_rtcp_report_blocks, json_report_block)) {
+ "source_ssrc", payload->report->report_block[i]->source_ssrc,
+ "fraction_lost", payload->report->report_block[i]->lost_count.fraction,
+ "packets_lost", payload->report->report_block[i]->lost_count.packets,
+ "highest_seq_no", payload->report->report_block[i]->highest_seq_no,
+ "ia_jitter", payload->report->report_block[i]->ia_jitter,
+ "lsr", str_lsr,
+ "dlsr", payload->report->report_block[i]->dlsr);
+ if (!json_report_block
+ || ast_json_array_append(json_rtcp_report_blocks, json_report_block)) {
+ ast_json_unref(json_rtcp_report_blocks);
return NULL;
}
}
@@ -2536,25 +2535,27 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
if (payload->report->type == AST_RTP_RTCP_SR) {
char sec[32];
char usec[32];
+
snprintf(sec, sizeof(sec), "%lu", (unsigned long)payload->report->sender_information.ntp_timestamp.tv_sec);
snprintf(usec, sizeof(usec), "%lu", (unsigned long)payload->report->sender_information.ntp_timestamp.tv_usec);
json_rtcp_sender_info = ast_json_pack("{s: s, s: s, s: i, s: i, s: i}",
- "ntp_timestamp_sec", sec,
- "ntp_timestamp_usec", usec,
- "rtp_timestamp", payload->report->sender_information.rtp_timestamp,
- "packets", payload->report->sender_information.packet_count,
- "octets", payload->report->sender_information.octet_count);
+ "ntp_timestamp_sec", sec,
+ "ntp_timestamp_usec", usec,
+ "rtp_timestamp", payload->report->sender_information.rtp_timestamp,
+ "packets", payload->report->sender_information.packet_count,
+ "octets", payload->report->sender_information.octet_count);
if (!json_rtcp_sender_info) {
+ ast_json_unref(json_rtcp_report_blocks);
return NULL;
}
}
json_rtcp_report = ast_json_pack("{s: i, s: i, s: i, s: o, s: o}",
- "ssrc", payload->report->ssrc,
- "type", payload->report->type,
- "report_count", payload->report->reception_report_count,
- "sender_information", json_rtcp_sender_info ? ast_json_ref(json_rtcp_sender_info) : ast_json_ref(ast_json_null()),
- "report_blocks", ast_json_ref(json_rtcp_report_blocks));
+ "ssrc", payload->report->ssrc,
+ "type", payload->report->type,
+ "report_count", payload->report->reception_report_count,
+ "sender_information", json_rtcp_sender_info ?: ast_json_null(),
+ "report_blocks", json_rtcp_report_blocks);
if (!json_rtcp_report) {
return NULL;
}
@@ -2562,14 +2563,15 @@ static struct ast_json *rtcp_report_to_json(struct stasis_message *msg,
if (payload->snapshot) {
json_channel = ast_channel_snapshot_to_json(payload->snapshot, sanitize);
if (!json_channel) {
+ ast_json_unref(json_rtcp_report);
return NULL;
}
}
return ast_json_pack("{s: o, s: o, s: o}",
- "channel", payload->snapshot ? ast_json_ref(json_channel) : ast_json_ref(ast_json_null()),
- "rtcp_report", ast_json_ref(json_rtcp_report),
- "blob", ast_json_deep_copy(payload->blob));
+ "channel", payload->snapshot ? json_channel : ast_json_null(),
+ "rtcp_report", json_rtcp_report,
+ "blob", ast_json_deep_copy(payload->blob) ?: ast_json_null());
}
static void rtp_rtcp_report_dtor(void *obj)