summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/abstract_jb.c4
-rw-r--r--main/aoc.c24
-rw-r--r--main/app.c13
3 files changed, 20 insertions, 21 deletions
diff --git a/main/abstract_jb.c b/main/abstract_jb.c
index 1c9eb5172..6e776c0cc 100644
--- a/main/abstract_jb.c
+++ b/main/abstract_jb.c
@@ -445,7 +445,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
/* Create a frame log file */
if (ast_test_flag(jbconf, AST_JB_LOG)) {
- RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(chan), ast_channel_cleanup);
+ struct ast_channel *bridged = ast_channel_bridge_peer(chan);
char safe_logfile[30] = "/tmp/logfile-XXXXXX";
int safe_fd;
@@ -481,6 +481,8 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
jb_framelog("JB_PUT_FIRST {now=%ld}: Dropped frame with ts=%ld and len=%ld\n",
now, frr->ts, frr->len);
}
+
+ ast_channel_cleanup(bridged);
}
ast_verb(3, "%s jitterbuffer created on channel %s\n", jbimpl->name, ast_channel_name(chan));
diff --git a/main/aoc.c b/main/aoc.c
index 707dbb00f..725e91071 100644
--- a/main/aoc.c
+++ b/main/aoc.c
@@ -1664,7 +1664,7 @@ static struct ast_json *currency_to_json(const char *name, int cost,
static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
{
- RAII_VAR(struct ast_json *, obj, NULL, ast_json_unref);
+ struct ast_json *obj;
const char *obj_type;
if (decoded->charge_type != AST_AOC_CHARGE_CURRENCY &&
@@ -1686,7 +1686,7 @@ static struct ast_json *charge_to_json(const struct ast_aoc_decoded *decoded)
"Type", aoc_charge_type_str(decoded->charge_type),
"BillingID", aoc_billingid_str(decoded->billing_id),
"TotalType", aoc_type_of_totaling_str(decoded->total_type),
- obj_type, ast_json_ref(obj));
+ obj_type, obj);
}
static struct ast_json *association_to_json(const struct ast_aoc_decoded *decoded)
@@ -1715,8 +1715,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
for (i = 0; i < decoded->aoc_s_count; ++i) {
struct ast_json *rate;
- RAII_VAR(struct ast_json *, type, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, currency, NULL, ast_json_unref);
+ struct ast_json *type = NULL;
+ struct ast_json *currency;
const char *charge_item = aoc_charged_item_str(
decoded->aoc_s_entries[i].charged_item);
@@ -1731,8 +1731,8 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
switch (decoded->aoc_s_entries[i].rate_type) {
case AST_AOC_RATE_TYPE_DURATION:
{
- RAII_VAR(struct ast_json *, time, NULL, ast_json_unref);
- RAII_VAR(struct ast_json *, granularity, NULL, ast_json_unref);
+ struct ast_json *time;
+ struct ast_json *granularity = NULL;
currency = currency_to_json(
decoded->aoc_s_entries[i].rate.duration.currency_name,
@@ -1750,11 +1750,11 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
}
type = ast_json_pack("{s:o, s:s, s:o, s:o}",
- "Currency", ast_json_ref(currency),
+ "Currency", currency,
"ChargingType", decoded->aoc_s_entries[i].rate.duration.charging_type
? "StepFunction" : "ContinuousCharging",
- "Time", ast_json_ref(time),
- "Granularity", granularity ? ast_json_ref(granularity) : ast_json_null());
+ "Time", time,
+ "Granularity", granularity ?: ast_json_null());
break;
}
@@ -1764,7 +1764,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
decoded->aoc_s_entries[i].rate.flat.amount,
decoded->aoc_s_entries[i].rate.flat.multiplier);
- type = ast_json_pack("{s:o}", "Currency", ast_json_ref(currency));
+ type = ast_json_pack("{s:o}", "Currency", currency);
break;
case AST_AOC_RATE_TYPE_VOLUME:
currency = currency_to_json(
@@ -1775,7 +1775,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
type = ast_json_pack("{s:s, s:o}",
"Unit", aoc_volume_unit_str(
decoded->aoc_s_entries[i].rate.volume.volume_unit),
- "Currency", ast_json_ref(currency));
+ "Currency", currency);
break;
case AST_AOC_RATE_TYPE_SPECIAL_CODE:
type = ast_json_pack("{s:i}",
@@ -1787,7 +1787,7 @@ static struct ast_json *s_to_json(const struct ast_aoc_decoded *decoded)
rate = ast_json_pack("{s:s, s:o}",
"Chargeable", charge_item,
- aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), ast_json_ref(type));
+ aoc_rate_type_str(decoded->aoc_s_entries[i].rate_type), type);
if (ast_json_array_append(rates, rate)) {
break;
}
diff --git a/main/app.c b/main/app.c
index 8ea6f82d9..04aca2b8c 100644
--- a/main/app.c
+++ b/main/app.c
@@ -3149,7 +3149,7 @@ struct stasis_topic *ast_mwi_topic(const char *uniqueid)
struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
{
- RAII_VAR(struct ast_mwi_state *, mwi_state, NULL, ao2_cleanup);
+ struct ast_mwi_state *mwi_state;
ast_assert(!ast_strlen_zero(mailbox));
@@ -3159,6 +3159,7 @@ struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
}
if (ast_string_field_init(mwi_state, 256)) {
+ ao2_ref(mwi_state, -1);
return NULL;
}
if (!ast_strlen_zero(context)) {
@@ -3167,7 +3168,6 @@ struct ast_mwi_state *ast_mwi_create(const char *mailbox, const char *context)
ast_string_field_set(mwi_state, uniqueid, mailbox);
}
- ao2_ref(mwi_state, +1);
return mwi_state;
}
@@ -3340,8 +3340,8 @@ struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
struct stasis_message_type *message_type,
struct ast_json *blob)
{
- RAII_VAR(struct ast_mwi_blob *, obj, NULL, ao2_cleanup);
- RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ struct ast_mwi_blob *obj;
+ struct stasis_message *msg;
ast_assert(blob != NULL);
@@ -3360,11 +3360,8 @@ struct stasis_message *ast_mwi_blob_create(struct ast_mwi_state *mwi_state,
/* This is not a normal MWI event. Only used by the MinivmNotify app. */
msg = stasis_message_create(message_type, obj);
- if (!msg) {
- return NULL;
- }
+ ao2_ref(obj, -1);
- ao2_ref(msg, +1);
return msg;
}