summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_voicemail.c3
-rw-r--r--channels/chan_console.c2
-rw-r--r--channels/chan_sip.c11
-rw-r--r--channels/chan_skinny.c6
-rw-r--r--funcs/func_callerid.c18
-rw-r--r--main/app.c32
-rw-r--r--main/cel.c4
-rw-r--r--main/manager_system.c9
-rw-r--r--main/rtp_engine.c60
-rw-r--r--main/stdtime/localtime.c46
-rw-r--r--main/xmldoc.c6
-rw-r--r--res/res_config_ldap.c4
12 files changed, 96 insertions, 105 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/channels/chan_console.c b/channels/chan_console.c
index 02d68870b..d7a72138d 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -1235,7 +1235,7 @@ static char *cli_console_active(struct ast_cli_entry *e, int cmd, struct ast_cli
return CLI_SUCCESS;
}
- if (!(pvt = find_pvt(a->argv[e->args - 1]))) {
+ if (!(pvt = find_pvt(a->argv[e->args]))) {
ast_cli(a->fd, "Could not find a device called '%s'.\n", a->argv[e->args]);
return CLI_FAILURE;
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 522e9d1d6..e6e82db46 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -23168,6 +23168,8 @@ static void change_redirecting_information(struct sip_pvt *p, struct sip_request
redirecting->from.number.valid = 1;
ast_free(redirecting->from.number.str);
redirecting->from.number.str = redirecting_from_number;
+ } else {
+ ast_free(redirecting_from_number);
}
if (!ast_strlen_zero(redirecting_from_name)) {
ast_debug(3, "Got redirecting from name %s\n", redirecting_from_name);
@@ -23175,6 +23177,8 @@ static void change_redirecting_information(struct sip_pvt *p, struct sip_request
redirecting->from.name.valid = 1;
ast_free(redirecting->from.name.str);
redirecting->from.name.str = redirecting_from_name;
+ } else {
+ ast_free(redirecting_from_name);
}
if (!ast_strlen_zero(p->cid_tag)) {
ast_free(redirecting->from.tag);
@@ -23188,13 +23192,17 @@ static void change_redirecting_information(struct sip_pvt *p, struct sip_request
redirecting->to.number.valid = 1;
ast_free(redirecting->to.number.str);
redirecting->to.number.str = redirecting_to_number;
+ } else {
+ ast_free(redirecting_to_number);
}
if (!ast_strlen_zero(redirecting_to_name)) {
- ast_debug(3, "Got redirecting to name %s\n", redirecting_from_number);
+ ast_debug(3, "Got redirecting to name %s\n", redirecting_to_name);
update_redirecting->to.name = 1;
redirecting->to.name.valid = 1;
ast_free(redirecting->to.name.str);
redirecting->to.name.str = redirecting_to_name;
+ } else {
+ ast_free(redirecting_to_name);
}
redirecting->reason.code = reason;
ast_free(redirecting->reason.str);
@@ -24223,6 +24231,7 @@ static void handle_response_subscribe(struct sip_pvt *p, int resp, const char *r
ast_cc_monitor_failed(monitor_instance->core_id,
monitor_instance->device_name,
"Received error response to our SUBSCRIBE");
+ ao2_ref(monitor_instance, -1);
}
return;
}
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index ccf6a9464..97634bcbc 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -4756,15 +4756,19 @@ static void start_rtp(struct skinny_subchannel *sub)
{
struct skinny_line *l = sub->line;
struct skinny_device *d = l->device;
+#if 0
int hasvideo = 0;
+#endif
struct ast_sockaddr bindaddr_tmp;
skinny_locksub(sub);
SKINNY_DEBUG(DEBUG_AUDIO, 3, "Sub %u - Starting RTP\n", sub->callid);
ast_sockaddr_from_sin(&bindaddr_tmp, &bindaddr);
sub->rtp = ast_rtp_instance_new("asterisk", sched, &bindaddr_tmp, NULL);
+#if 0
if (hasvideo)
sub->vrtp = ast_rtp_instance_new("asterisk", sched, &bindaddr_tmp, NULL);
+#endif
if (sub->rtp) {
ast_rtp_instance_set_prop(sub->rtp, AST_RTP_PROPERTY_RTCP, 1);
@@ -4778,11 +4782,13 @@ static void start_rtp(struct skinny_subchannel *sub)
ast_channel_set_fd(sub->owner, 0, ast_rtp_instance_fd(sub->rtp, 0));
ast_channel_set_fd(sub->owner, 1, ast_rtp_instance_fd(sub->rtp, 1));
}
+#if 0
if (hasvideo && sub->vrtp && sub->owner) {
ast_rtp_instance_set_channel_id(sub->vrtp, ast_channel_uniqueid(sub->owner));
ast_channel_set_fd(sub->owner, 2, ast_rtp_instance_fd(sub->vrtp, 0));
ast_channel_set_fd(sub->owner, 3, ast_rtp_instance_fd(sub->vrtp, 1));
}
+#endif
if (sub->rtp) {
ast_rtp_instance_set_qos(sub->rtp, qos.tos_audio, qos.cos_audio, "Skinny RTP");
ast_rtp_instance_set_prop(sub->rtp, AST_RTP_PROPERTY_NAT, l->nat);
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/app.c b/main/app.c
index 04aca2b8c..f01d06513 100644
--- a/main/app.c
+++ b/main/app.c
@@ -1029,30 +1029,42 @@ int ast_linear_stream(struct ast_channel *chan, const char *filename, int fd, in
{
struct linear_state *lin;
char tmpf[256];
- int res = -1;
int autoclose = 0;
+
if (fd < 0) {
if (ast_strlen_zero(filename)) {
return -1;
}
+
autoclose = 1;
+
if (filename[0] == '/') {
ast_copy_string(tmpf, filename, sizeof(tmpf));
} else {
snprintf(tmpf, sizeof(tmpf), "%s/%s/%s", ast_config_AST_DATA_DIR, "sounds", filename);
}
- if ((fd = open(tmpf, O_RDONLY)) < 0) {
+
+ fd = open(tmpf, O_RDONLY);
+ if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open file '%s': %s\n", tmpf, strerror(errno));
return -1;
}
}
- if ((lin = ast_calloc(1, sizeof(*lin)))) {
- lin->fd = fd;
- lin->allowoverride = allowoverride;
- lin->autoclose = autoclose;
- res = ast_activate_generator(chan, &linearstream, lin);
+
+ lin = ast_calloc(1, sizeof(*lin));
+ if (!lin) {
+ if (autoclose) {
+ close(fd);
+ }
+
+ return -1;
}
- return res;
+
+ lin->fd = fd;
+ lin->allowoverride = allowoverride;
+ lin->autoclose = autoclose;
+
+ return ast_activate_generator(chan, &linearstream, lin);
}
static int control_streamfile(struct ast_channel *chan,
@@ -1351,10 +1363,10 @@ int ast_control_tone(struct ast_channel *chan, const char *tone)
ts = ast_get_indication_tone(zone ? zone : ast_channel_zone(chan), tone_indication);
if (ast_playtones_start(chan, 0, ts ? ts->data : tone_indication, 0)) {
- return -1;
+ res = -1;
}
- for (;;) {
+ while (!res) {
struct ast_frame *fr;
if (ast_waitfor(chan, -1) < 0) {
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/manager_system.c b/main/manager_system.c
index b852c52e6..7a4896a68 100644
--- a/main/manager_system.c
+++ b/main/manager_system.c
@@ -44,7 +44,6 @@ static void manager_system_shutdown(void)
int manager_system_init(void)
{
- int ret = 0;
struct stasis_topic *manager_topic;
struct stasis_topic *system_topic;
struct stasis_message_router *message_router;
@@ -69,13 +68,5 @@ int manager_system_init(void)
ast_register_cleanup(manager_system_shutdown);
- /* If somehow we failed to add any routes, just shut down the whole
- * thing and fail it.
- */
- if (ret) {
- manager_system_shutdown();
- return -1;
- }
-
return 0;
}
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)
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index 5b5526e6f..64840e826 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -1508,16 +1508,14 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
}
} else {
long theirstdoffset;
- long theirdstoffset;
long theiroffset;
- int isdst;
int i;
int j;
if (*name != '\0')
return -1;
/*
- ** Initial values of theirstdoffset and theirdstoffset.
+ ** Initial values of theirstdoffset.
*/
theirstdoffset = 0;
for (i = 0; i < sp->timecnt; ++i) {
@@ -1528,19 +1526,6 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
break;
}
}
- theirdstoffset = 0;
- for (i = 0; i < sp->timecnt; ++i) {
- j = sp->types[i];
- if (sp->ttis[j].tt_isdst) {
- theirdstoffset =
- -sp->ttis[j].tt_gmtoff;
- break;
- }
- }
- /*
- ** Initially we're assumed to be in standard time.
- */
- isdst = FALSE;
theiroffset = theirstdoffset;
/*
** Now juggle transition times and types
@@ -1552,32 +1537,13 @@ static int tzparse(const char *name, struct state *sp, const int lastditch)
if (sp->ttis[j].tt_ttisgmt) {
/* No adjustment to transition time */
} else {
- /*
- ** If summer time is in effect, and the
- ** transition time was not specified as
- ** standard time, add the summer time
- ** offset to the transition time;
- ** otherwise, add the standard time
- ** offset to the transition time.
- */
- /*
- ** Transitions from DST to DDST
- ** will effectively disappear since
- ** POSIX provides for only one DST
- ** offset.
- */
- if (isdst && !sp->ttis[j].tt_ttisstd) {
- sp->ats[i] += dstoffset -
- theirdstoffset;
- } else {
- sp->ats[i] += stdoffset -
- theirstdoffset;
- }
+ /* Add the standard time offset to the transition time. */
+ sp->ats[i] += stdoffset - theirstdoffset;
}
theiroffset = -sp->ttis[j].tt_gmtoff;
- if (sp->ttis[j].tt_isdst)
- theirdstoffset = theiroffset;
- else theirstdoffset = theiroffset;
+ if (!sp->ttis[j].tt_isdst) {
+ theirstdoffset = theiroffset;
+ }
}
/*
** Finally, fill in ttis.
diff --git a/main/xmldoc.c b/main/xmldoc.c
index da753cd15..5addb23b4 100644
--- a/main/xmldoc.c
+++ b/main/xmldoc.c
@@ -1413,7 +1413,7 @@ static int xmldoc_parse_example(struct ast_xml_node *fixnode, struct ast_str **b
static int xmldoc_parse_specialtags(struct ast_xml_node *fixnode, const char *tabs, const char *posttabs, struct ast_str **buffer)
{
struct ast_xml_node *node = fixnode;
- int ret = 0, i, count = 0;
+ int ret = 0, i;
if (!node || !ast_xml_node_get_children(node)) {
return ret;
@@ -1440,8 +1440,8 @@ static int xmldoc_parse_specialtags(struct ast_xml_node *fixnode, const char *ta
/* parse <para> elements inside special tags. */
for (node = ast_xml_node_get_children(node); node; node = ast_xml_node_get_next(node)) {
/* first <para> just print it without tabs at the begining. */
- if ((xmldoc_parse_para(node, (!count ? "" : tabs), posttabs, buffer) == 2)
- || (xmldoc_parse_info(node, (!count ? "": tabs), posttabs, buffer) == 2)) {
+ if ((xmldoc_parse_para(node, "", posttabs, buffer) == 2)
+ || (xmldoc_parse_info(node, "", posttabs, buffer) == 2)) {
ret = 2;
}
}
diff --git a/res/res_config_ldap.c b/res/res_config_ldap.c
index a21aa31a8..c03b84967 100644
--- a/res/res_config_ldap.c
+++ b/res/res_config_ldap.c
@@ -311,8 +311,10 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
BerElement *ber = NULL;
struct ast_variable *var = NULL;
struct ast_variable *prev = NULL;
+#if 0
int is_delimited = 0;
int i = 0;
+#endif
char *ldap_attribute_name;
struct berval *value;
int pos = 0;
@@ -340,6 +342,7 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
ast_debug(2, "md5: %s\n", valptr);
}
if (valptr) {
+#if 0
/* ok, so looping through all delimited values except the last one (not, last character is not delimited...) */
if (is_delimited) {
i = 0;
@@ -360,6 +363,7 @@ static struct ast_variable *realtime_ldap_entry_to_var(struct ldap_table_config
i++;
}
}
+#endif
/* for the last delimited value or if the value is not delimited: */
if (prev) {
prev->next = ast_variable_new(attribute_name, &valptr[pos], table_config->table_name);