res_pjsip, res_pjsip_session: initialize local variables
authorKevin Harwell <kharwell@digium.com>
Mon, 19 Oct 2020 20:31:14 +0000 (15:31 -0500)
committerGeorge Joseph <gjoseph@digium.com>
Wed, 28 Oct 2020 14:51:44 +0000 (09:51 -0500)
This patch initializes a couple of local variables to some default values.
Interestingly, in the 'pj_status_t dlg_status' case the value not being
initialized caused memory to grow, and not be recovered, in the off nominal
path (at least on my machine).

Change-Id: I22ee65e1e1bff8efacea8a167c6c8428898523f7

res/res_pjsip/pjsip_transport_management.c
res/res_pjsip_session.c

index af572d3..e14c8e9 100644 (file)
@@ -78,7 +78,7 @@ static void keepalive_transport_send_keepalive(struct monitored_transport *monit
 static void *keepalive_transport_thread(void *data)
 {
        struct ao2_container *transports;
-       pj_thread_desc desc;
+       pj_thread_desc desc = { 0 };
        pj_thread_t *thread;
 
        if (pj_thread_register("Asterisk Keepalive Thread", desc, &thread) != PJ_SUCCESS) {
index 82234aa..ec01145 100644 (file)
@@ -3747,7 +3747,7 @@ static pjsip_inv_session *pre_session_setup(pjsip_rx_data *rdata, const struct a
        pjsip_dialog *dlg;
        pjsip_inv_session *inv_session;
        unsigned int options = endpoint->extensions.flags;
-       pj_status_t dlg_status;
+       pj_status_t dlg_status = PJ_EUNKNOWN;
 
        if (pjsip_inv_verify_request(rdata, &options, NULL, NULL, ast_sip_get_pjsip_endpoint(), &tdata) != PJ_SUCCESS) {
                if (tdata) {