summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/samples/res_config_sqlite.conf.sample2
-rw-r--r--main/cdr.c12
-rw-r--r--res/res_ari.c2
-rw-r--r--res/res_pjsip/pjsip_configuration.c18
4 files changed, 13 insertions, 21 deletions
diff --git a/configs/samples/res_config_sqlite.conf.sample b/configs/samples/res_config_sqlite.conf.sample
index 04e6ae2e7..2d14d46a3 100644
--- a/configs/samples/res_config_sqlite.conf.sample
+++ b/configs/samples/res_config_sqlite.conf.sample
@@ -8,4 +8,4 @@ dbfile => /var/lib/asterisk/sqlite.db
; extconfig.conf, the value given here is used. If cdr_table is omitted, CDR
; support is simply disabled.
config_table => ast_config
-cdr_table => ast_cdr
+; cdr_table => ast_cdr
diff --git a/main/cdr.c b/main/cdr.c
index 4bcfc05b3..6a5b33cbd 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -754,11 +754,7 @@ static void free_variables(struct varshead *headp)
*/
static void cdr_object_snapshot_copy(struct cdr_object_snapshot *dst, struct cdr_object_snapshot *src)
{
- if (dst->snapshot) {
- ao2_t_ref(dst->snapshot, -1, "release old snapshot during copy");
- }
- dst->snapshot = src->snapshot;
- ao2_t_ref(dst->snapshot, +1, "bump new snapshot during copy");
+ ao2_t_replace(dst->snapshot, src->snapshot, "CDR snapshot copy");
strcpy(dst->userfield, src->userfield);
dst->flags = src->flags;
copy_variables(&dst->variables, &src->variables);
@@ -1361,11 +1357,7 @@ static void cdr_object_swap_snapshot(struct cdr_object_snapshot *old_snapshot,
struct ast_channel_snapshot *new_snapshot)
{
cdr_object_update_cid(old_snapshot, new_snapshot);
- if (old_snapshot->snapshot) {
- ao2_t_ref(old_snapshot->snapshot, -1, "Drop ref for swap");
- }
- ao2_t_ref(new_snapshot, +1, "Bump ref for swap");
- old_snapshot->snapshot = new_snapshot;
+ ao2_t_replace(old_snapshot->snapshot, new_snapshot, "Swap CDR shapshot");
}
/* BASE METHOD IMPLEMENTATIONS */
diff --git a/res/res_ari.c b/res/res_ari.c
index c6fbc6c50..d99150b7a 100644
--- a/res/res_ari.c
+++ b/res/res_ari.c
@@ -886,7 +886,7 @@ static int ast_ari_callback(struct ast_tcptls_session_instance *ser,
RAII_VAR(struct ast_variable *, post_vars, NULL, ast_variables_destroy);
struct ast_variable *var;
const char *app_name = NULL;
- RAII_VAR(struct ast_json *, body, ast_json_null(), ast_json_free);
+ RAII_VAR(struct ast_json *, body, ast_json_null(), ast_json_unref);
int debug_app = 0;
if (!response_body) {
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 437476631..a39102305 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -1314,6 +1314,14 @@ static struct ast_endpoint *persistent_endpoint_find_or_create(const struct ast_
ast_endpoint_set_state(persistent->endpoint, AST_ENDPOINT_OFFLINE);
ao2_link_flags(persistent_endpoints, persistent, OBJ_NOLOCK);
+ } else if (strcmp(persistent->aors, endpoint->aors)) {
+ char *new_aors = ast_strdup(endpoint->aors);
+
+ /* make sure we don't NULL persistent->aors if allocation fails. */
+ if (new_aors) {
+ ast_free(persistent->aors);
+ persistent->aors = new_aors;
+ }
}
ao2_ref(persistent->endpoint, +1);
@@ -1790,20 +1798,12 @@ static struct ast_cli_entry cli_commands[] = {
struct ast_sip_cli_formatter_entry *channel_formatter;
struct ast_sip_cli_formatter_entry *endpoint_formatter;
-static int on_load_endpoint(void *obj, void *arg, int flags)
-{
- return sip_endpoint_apply_handler(sip_sorcery, obj);
-}
-
static void load_all_endpoints(void)
{
struct ao2_container *endpoints;
endpoints = ast_sorcery_retrieve_by_fields(sip_sorcery, "endpoint", AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL);
- if (endpoints) {
- ao2_callback(endpoints, OBJ_NODATA, on_load_endpoint, NULL);
- ao2_ref(endpoints, -1);
- }
+ ao2_cleanup(endpoints);
}
int ast_res_pjsip_initialize_configuration(void)