compilation failed with -Werror=maybe-uninitialized
authorAlexei Gradinari <alex2grad@gmail.com>
Fri, 19 Aug 2016 15:21:01 +0000 (11:21 -0400)
committerAlexei Gradinari <alex2grad@gmail.com>
Mon, 22 Aug 2016 13:56:11 +0000 (08:56 -0500)
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

res/res_pjsip/pjsip_configuration.c

index 3bced11..23aa522 100644 (file)
@@ -963,7 +963,9 @@ static int dtls_handler(const struct aco_option *opt,
 {
        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);