]> granicus.if.org Git - curl/commitdiff
lib: fix maybe-uninitialized warnings
authorMarcel Raad <raad@teamviewer.com>
Sat, 22 Apr 2017 20:12:37 +0000 (22:12 +0200)
committerMarcel Raad <raad@teamviewer.com>
Sat, 22 Apr 2017 20:12:37 +0000 (22:12 +0200)
With -Og, GCC complains:

easy.c:628:7: error: ‘mcode’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

../lib/strcase.h:35:29: error: ‘tok_buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
vauth/digest.c:208:9: note: ‘tok_buf’ was declared here

../lib/strcase.h:35:29: error: ‘tok_buf’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
vauth/digest.c:566:15: note: ‘tok_buf’ was declared here

Fix this by initializing the variables.

lib/easy.c
lib/vauth/digest.c

index 2b5f972e12a69e7d31e2d314971bef509ba60358..5189d0794f74b3f521dcaf7a10046d0e868a2bfe 100644 (file)
@@ -561,7 +561,7 @@ static void events_setup(struct Curl_multi *multi, struct events *ev)
 static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
 {
   bool done = FALSE;
-  CURLMcode mcode;
+  CURLMcode mcode = CURLM_OK;
   CURLcode result = CURLE_OK;
 
   while(!done) {
index 31d25cfa10e3e605726e870b5efc2adc7f599317..268474c78e656a991c5d89a9ae507c3f6c57fe37 100644 (file)
@@ -205,7 +205,7 @@ static CURLcode auth_digest_get_qop_values(const char *options, int *value)
 {
   char *tmp;
   char *token;
-  char *tok_buf;
+  char *tok_buf = NULL;
 
   /* Initialise the output */
   *value = 0;
@@ -563,7 +563,7 @@ CURLcode Curl_auth_decode_digest_http_message(const char *chlg,
           return CURLE_OUT_OF_MEMORY;
       }
       else if(strcasecompare(value, "qop")) {
-        char *tok_buf;
+        char *tok_buf = NULL;
         /* Tokenize the list and choose auth if possible, use a temporary
            clone of the buffer since strtok_r() ruins it */
         tmp = strdup(content);