summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-11-21 09:27:31 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-21 09:27:31 -0600
commit48ec7e49e8a179a6a99b1cf6e0b8b8f04e106b0b (patch)
tree053da64e6ff518bf5d0f1bb8e4cf23b384039c91
parentd92b7863594577456ae1c863fe917855757e0b58 (diff)
parentf893822a8b290f3b3dfe764246f07f2df89d48f4 (diff)
Merge "app: Remove silly usage of RAII_VAR." into 15
-rw-r--r--main/app.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/main/app.c b/main/app.c
index 69c96c06c..f35c4b7d2 100644
--- a/main/app.c
+++ b/main/app.c
@@ -3138,7 +3138,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));
@@ -3148,6 +3148,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)) {
@@ -3156,7 +3157,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;
}
@@ -3329,8 +3329,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);
@@ -3349,11 +3349,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;
}