summaryrefslogtreecommitdiff
path: root/main/app.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-11-16 13:51:37 -0500
committerCorey Farrell <git@cfware.com>2017-11-20 15:09:02 -0500
commitddc86ec66417f4ba9431be434ad2aabca0182869 (patch)
treee85c7ee27a331b16fe634e94b10957a8e7605ea5 /main/app.c
parentbef287ccf2f168737250e62daccc2e0ff6d30e59 (diff)
app: Remove silly usage of RAII_VAR.
Change-Id: Ideb594f7aae134974fb78d5477ba0853b97b8625
Diffstat (limited to 'main/app.c')
-rw-r--r--main/app.c13
1 files changed, 5 insertions, 8 deletions
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;
}