res_pjsip: Use reasonable buffer lengths for endpoint identification
[asterisk/asterisk.git] / res / res_pjsip_outbound_registration.c
index 4697e5c..d9afcd2 100644 (file)
@@ -19,6 +19,7 @@
 /*** MODULEINFO
        <depend>pjproject</depend>
        <depend>res_pjsip</depend>
+       <use type="module">res_statsd</use>
        <support_level>core</support_level>
  ***/
 
@@ -1384,10 +1385,10 @@ static int sip_outbound_registration_perform(void *data)
 
        AST_VECTOR_INIT(&state->client_state->outbound_auths, AST_VECTOR_SIZE(&registration->outbound_auths));
        for (i = 0; i < AST_VECTOR_SIZE(&registration->outbound_auths); ++i) {
-               const char *name = ast_strdup(AST_VECTOR_GET(&registration->outbound_auths, i));
+               char *name = ast_strdup(AST_VECTOR_GET(&registration->outbound_auths, i));
 
-               if (name) {
-                       AST_VECTOR_APPEND(&state->client_state->outbound_auths, name);
+               if (name && AST_VECTOR_APPEND(&state->client_state->outbound_auths, name)) {
+                       ast_free(name);
                }
        }
        state->client_state->retry_interval = registration->retry_interval;