diff options
author | Corey Farrell <git@cfware.com> | 2017-11-06 16:10:56 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2017-11-06 16:13:58 -0500 |
commit | 75539dbf2cdd282a1cdad1b7d8167c2d3d80e999 (patch) | |
tree | 68cf03162e3978fd7e77dd134fdfba8f2e86b220 /main/message.c | |
parent | ad7860fd194b69a86f43b41d6c20cdb2b653481d (diff) |
Messaging: Report error on failure to register tech or handler.
Message tech and handler registrations use a vector which could fail to
expand. If it does log and error and return error.
Change-Id: I593a8de81a07fb0452e9b0efd5d4018b77bca6f4
Diffstat (limited to 'main/message.c')
-rw-r--r-- | main/message.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/main/message.c b/main/message.c index be0035d30..caee37c81 100644 --- a/main/message.c +++ b/main/message.c @@ -1364,7 +1364,12 @@ int ast_msg_tech_register(const struct ast_msg_tech *tech) return -1; } - AST_VECTOR_APPEND(&msg_techs, tech); + if (AST_VECTOR_APPEND(&msg_techs, tech)) { + ast_log(LOG_ERROR, "Failed to register message technology for '%s'\n", + tech->name); + ast_rwlock_unlock(&msg_techs_lock); + return -1; + } ast_verb(3, "Message technology '%s' registered.\n", tech->name); ast_rwlock_unlock(&msg_techs_lock); @@ -1419,7 +1424,12 @@ int ast_msg_handler_register(const struct ast_msg_handler *handler) return -1; } - AST_VECTOR_APPEND(&msg_handlers, handler); + if (AST_VECTOR_APPEND(&msg_handlers, handler)) { + ast_log(LOG_ERROR, "Failed to register message handler for '%s'\n", + handler->name); + ast_rwlock_unlock(&msg_handlers_lock); + return -1; + } ast_verb(2, "Message handler '%s' registered.\n", handler->name); ast_rwlock_unlock(&msg_handlers_lock); |