[Asterisk-code-review] res pjsip: Fix initialization of extended stringfields. (asterisk[13])
Corey Farrell
asteriskteam at digium.com
Wed Apr 18 16:25:35 CDT 2018
Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/8825
Change subject: res_pjsip: Fix initialization of extended stringfields.
......................................................................
res_pjsip: Fix initialization of extended stringfields.
It is possible for initialization of extended stringfields to fail. Add
checks for this failure.
Change-Id: I062e09852db3d37ceefaf6c2048958fa0118304f
---
M res/res_pjsip/location.c
M res/res_pjsip/pjsip_configuration.c
2 files changed, 7 insertions(+), 9 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/25/8825/1
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 52d84c3..3abba3b 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -118,15 +118,14 @@
return NULL;
}
- if (ast_string_field_init(contact, 256)) {
+ if (ast_string_field_init(contact, 256)
+ || ast_string_field_init_extended(contact, endpoint_name)
+ || ast_string_field_init_extended(contact, reg_server)
+ || ast_string_field_init_extended(contact, via_addr)
+ || ast_string_field_init_extended(contact, call_id)) {
ao2_cleanup(contact);
return NULL;
}
-
- ast_string_field_init_extended(contact, endpoint_name);
- ast_string_field_init_extended(contact, reg_server);
- ast_string_field_init_extended(contact, via_addr);
- ast_string_field_init_extended(contact, call_id);
/* Dynamic contacts are delimited with ";@" and static ones with "@@" */
if ((aor_separator = strstr(id, ";@")) || (aor_separator = strstr(id, "@@"))) {
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index e88f019..5e5d40c 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -2197,12 +2197,11 @@
if (!endpoint) {
return NULL;
}
- if (ast_string_field_init(endpoint, 64)) {
+ if (ast_string_field_init(endpoint, 64)
+ || ast_string_field_init_extended(endpoint, incoming_mwi_mailbox)) {
ao2_cleanup(endpoint);
return NULL;
}
-
- ast_string_field_init_extended(endpoint, incoming_mwi_mailbox);
if (!(endpoint->media.codecs = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
ao2_cleanup(endpoint);
--
To view, visit https://gerrit.asterisk.org/8825
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I062e09852db3d37ceefaf6c2048958fa0118304f
Gerrit-Change-Number: 8825
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180418/452abc84/attachment-0001.html>
More information about the asterisk-code-review
mailing list