[Asterisk-code-review] compilation failed with -Werror=maybe-uninitialized (asterisk[master])

Anonymous Coward asteriskteam at digium.com
Mon Aug 22 11:22:13 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: compilation failed with -Werror=maybe-uninitialized
......................................................................


compilation failed with -Werror=maybe-uninitialized

The compilation failed for devmode
--enable DONT_OPTIMIZE
--enable BETTER_BACKTRACES
--enable DO_CRASH
--enable TEST_FRAMEWORK

res_pjsip/pjsip_configuration.c: In function dtls_handler:
res_pjsip/pjsip_configuration.c:974:20: error:
back may be used uninitialized in this function [-Werror=maybe-uninitialized]
int size = strlen(front);
           ^
cc1: all warnings being treated as errors

Change-Id: I7f082ead0312792a577ec7c73015ba64dabca580
---
M res/res_pjsip/pjsip_configuration.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 3bced11..23aa522 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -963,7 +963,9 @@
 {
 	struct ast_sip_endpoint *endpoint = obj;
 	char *name = ast_strdupa(var->name);
-	char *front, *back, *buf = name;
+	char *front = NULL;
+	char *back = NULL;
+	char *buf = name;
 
 	/* strip out underscores in the name */
 	front = strtok_r(buf, "_", &back);

-- 
To view, visit https://gerrit.asterisk.org/3671
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f082ead0312792a577ec7c73015ba64dabca580
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Alexei Gradinari <alex2grad at gmail.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list