[Asterisk-code-review] res_pjsip, res_pjsip_session: initialize local variables (asterisk[13])

Friendly Automation asteriskteam at digium.com
Wed Oct 28 09:33:51 CDT 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/15100 )

Change subject: res_pjsip, res_pjsip_session: initialize local variables
......................................................................

res_pjsip, res_pjsip_session: initialize local variables

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
---
M res/res_pjsip/pjsip_transport_management.c
M res/res_pjsip_session.c
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_pjsip/pjsip_transport_management.c b/res/res_pjsip/pjsip_transport_management.c
index ceac889..b57ce75 100644
--- a/res/res_pjsip/pjsip_transport_management.c
+++ b/res/res_pjsip/pjsip_transport_management.c
@@ -78,7 +78,7 @@
 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) {
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index eb0db18..c93be19 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -2092,7 +2092,7 @@
 	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) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15100
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I22ee65e1e1bff8efacea8a167c6c8428898523f7
Gerrit-Change-Number: 15100
Gerrit-PatchSet: 2
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201028/245122e0/attachment-0001.html>


More information about the asterisk-code-review mailing list