From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.1 From: Aleksei Nikiforov To: devel@lists.altlinux.org Date: Thu, 12 Dec 2019 12:57:30 +0300 Message-Id: <20191212095730.83787-22-darktemplar@altlinux.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191212095730.83787-1-darktemplar@altlinux.org> References: <20191211234857.GB17949@altlinux.org> <20191212095730.83787-1-darktemplar@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Aleksei Nikiforov Subject: [devel] [PATCH for apt v2 21/21] Fix invalid check of Queue against zero X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2019 09:58:30 -0000 Archived-At: List-Archive: List-Post: Queue must not be zero in this function, otherwise it'd crash in this function anyway, since it's used like it's never zero later. Found via clang-static-analyzer: Logic error: Called C++ object pointer is null: Called C++ object pointer is null --- apt/apt-pkg/acquire-method.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apt/apt-pkg/acquire-method.cc b/apt/apt-pkg/acquire-method.cc index 9a3ef1d..3b5c580 100644 --- a/apt/apt-pkg/acquire-method.cc +++ b/apt/apt-pkg/acquire-method.cc @@ -555,9 +555,7 @@ void pkgAcqMethod::Warning(const char *Format,...) to keep the pipeline synchronized. */ void pkgAcqMethod::Redirect(const string &NewURI) { - string CurrentURI = ""; - if (Queue != 0) - CurrentURI = Queue->Uri; + string CurrentURI = Queue->Uri; ostringstream s; s << "103 Redirect\nURI: " << CurrentURI << "\nNew-URI: " << NewURI -- 2.24.1