[or-cvs] r17669: {tor} Massage a little code to hopfully please coverity. (tor/trunk/src/or)

nickm at seul.org nickm at seul.org
Thu Dec 18 04:45:52 UTC 2008


Author: nickm
Date: 2008-12-17 23:45:51 -0500 (Wed, 17 Dec 2008)
New Revision: 17669

Modified:
   tor/trunk/src/or/control.c
   tor/trunk/src/or/test.c
Log:
Massage a little code to hopfully please coverity.

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-12-18 04:45:47 UTC (rev 17668)
+++ tor/trunk/src/or/control.c	2008-12-18 04:45:51 UTC (rev 17669)
@@ -764,8 +764,8 @@
         msg = "553 Unable to set option";
         break;
       case SETOPT_OK:
-        /* coverity[dead_error_line]
-         * (It's okay if we can never get to this point.) */
+        /* (It's okay if we can never get to this point.) */
+        /* coverity[dead_error_line] */
         msg = "551 Internal error";
         tor_fragile_assert();
         break;
@@ -1194,8 +1194,8 @@
  err:
   tor_free(password);
   if (!errstr) {
-    /* coverity[dead_error_line]
-     * (It's okay if we can never get to this point.) */
+    /* (It's okay if we can never get to this point.) */
+    /* coverity[dead_error_line] */
     errstr = "Unknown reason.";
   }
   connection_printf_to_buf(conn, "515 Authentication failed: %s\r\n",

Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c	2008-12-18 04:45:47 UTC (rev 17668)
+++ tor/trunk/src/or/test.c	2008-12-18 04:45:51 UTC (rev 17669)
@@ -3588,15 +3588,16 @@
                            const char *expected_summary)
 {
   config_line_t line;
-  smartlist_t *policy = NULL;
+  smartlist_t *policy = smartlist_create();
   char *summary = NULL;
+  int r;
 
-  policy = NULL;
   line.key = (char*)"foo";
   line.value = (char *)policy_str;
   line.next = NULL;
 
-  test_assert(0 == policies_parse_exit_policy(&line, &policy, 0, NULL));
+  r = policies_parse_exit_policy(&line, &policy, 0, NULL);
+  test_eq(r, 0);
   summary = policy_summarize(policy);
 
   test_assert(summary != NULL);
@@ -4184,6 +4185,8 @@
   crypto_free_cipher_env(cipher);
   cipher = NULL;
   test_eq(encrypted_size, 16 + 1);
+  tor_assert(encrypted_size > 0); /*XXXX021 Obviously this is true. But does
+                                   * this make Coverity happy? */
   cipher = crypto_create_init_cipher(key1, 0);
   decrypted_size = crypto_cipher_decrypt_with_iv(cipher, decrypted1, 1,
                                              encrypted1, encrypted_size);



More information about the tor-commits mailing list