]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add missing return statements after self_destruct() in rock config
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 23 Feb 2017 10:40:27 +0000 (23:40 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 23 Feb 2017 10:40:27 +0000 (23:40 +1300)
  Detected by Coverity Scan. Issues 115421911542201154221.

------------- This line and the following will be ignored --------------

modified:
  src/fs/rock/RockSwapDir.cc

src/fs/rock/RockSwapDir.cc

index 9b0c76d4ac6efea4c06ef306974ec6dbff9529e4..01cc52ca0d746769838ae131bd883b4f3ab0de51 100644 (file)
@@ -430,14 +430,17 @@ Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconf
     else
         return false;
 
-    if (!value)
+    if (!value) {
         self_destruct();
+        return;
+    }
 
     // TODO: handle time units and detect parsing errors better
     const int64_t parsedValue = strtoll(value, NULL, 10);
     if (parsedValue < 0) {
         debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must not be negative but is: " << parsedValue);
         self_destruct();
+        return;
     }
 
     const time_msec_t newTime = static_cast<time_msec_t>(parsedValue);
@@ -472,14 +475,17 @@ Rock::SwapDir::parseRateOption(char const *option, const char *value, int isaRec
     else
         return false;
 
-    if (!value)
+    if (!value) {
         self_destruct();
+        return;
+    }
 
     // TODO: handle time units and detect parsing errors better
     const int64_t parsedValue = strtoll(value, NULL, 10);
     if (parsedValue < 0) {
         debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must not be negative but is: " << parsedValue);
         self_destruct();
+        return;
     }
 
     const int newRate = static_cast<int>(parsedValue);
@@ -487,6 +493,7 @@ Rock::SwapDir::parseRateOption(char const *option, const char *value, int isaRec
     if (newRate < 0) {
         debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must not be negative but is: " << newRate);
         self_destruct();
+        return;
     }
 
     if (!isaReconfig)
@@ -518,19 +525,23 @@ Rock::SwapDir::parseSizeOption(char const *option, const char *value, int reconf
     else
         return false;
 
-    if (!value)
+    if (!value) {
         self_destruct();
+        return;
+    }
 
     // TODO: handle size units and detect parsing errors better
     const uint64_t newSize = strtoll(value, NULL, 10);
     if (newSize <= 0) {
         debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must be positive; got: " << newSize);
         self_destruct();
+        return;
     }
 
     if (newSize <= sizeof(DbCellHeader)) {
         debugs(3, DBG_CRITICAL, "FATAL: cache_dir " << path << ' ' << option << " must exceed " << sizeof(DbCellHeader) << "; got: " << newSize);
         self_destruct();
+        return;
     }
 
     if (!reconfig)