From: Amos Jeffries Date: Thu, 23 Feb 2017 10:40:27 +0000 (+1300) Subject: Add missing return statements after self_destruct() in rock config X-Git-Tag: M-staged-PR71~246 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=311ebdcce7fc73abc87ed4699a9b335fde3d0491;p=thirdparty%2Fsquid.git Add missing return statements after self_destruct() in rock config Detected by Coverity Scan. Issues 1154219, 1154220, 1154221. ------------- This line and the following will be ignored -------------- modified: src/fs/rock/RockSwapDir.cc --- diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 9b0c76d4ac..01cc52ca0d 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -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(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(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)