]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/acquire-methods.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 14 May 2012 14:53:43 +0000 (16:53 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Mon, 14 May 2012 14:53:43 +0000 (16:53 +0200)
  - factor out into private Dequeue() to fix access to deleted pointer

apt-pkg/acquire-method.cc
apt-pkg/acquire-method.h
debian/changelog

index 2041fd9e973f3ec12d4dead3e5a0f4556b159f96..e6e02bbc588319748d518f650a8bbd9edb676914 100644 (file)
@@ -95,12 +95,7 @@ void pkgAcqMethod::Fail(string Err,bool Transient)
    {
       std::cout << "400 URI Failure\nURI: " << Queue->Uri << "\n"
                << "Message: " << Err << " " << IP << "\n";
-      // Dequeue
-      FetchItem *Tmp = Queue;
-      Queue = Queue->Next;
-      delete Tmp;
-      if (Tmp == QueueBack)
-        QueueBack = Queue;
+      Dequeue();
    }
    else
       std::cout << "400 URI Failure\nURI: <UNKNOWN>\nMessage: " << Err << "\n";
@@ -211,13 +206,7 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
    }
 
    std::cout << "\n" << std::flush;
-
-   // Dequeue
-   FetchItem *Tmp = Queue;
-   Queue = Queue->Next;
-   delete Tmp;
-   if (Tmp == QueueBack)
-      QueueBack = Queue;
+   Dequeue();
 }
                                                                        /*}}}*/
 // AcqMethod::MediaFail - Syncronous request for new media             /*{{{*/
@@ -465,3 +454,11 @@ void pkgAcqMethod::FetchResult::TakeHashes(Hashes &Hash)
    SHA512Sum = Hash.SHA512.Result();
 }
                                                                        /*}}}*/
+void pkgAcqMethod::Dequeue() {                                         /*{{{*/
+   FetchItem const * const Tmp = Queue;
+   Queue = Queue->Next;
+   if (Tmp == QueueBack)
+      QueueBack = Queue;
+   delete Tmp;
+}
+                                                                       /*}}}*/
index 2dd9ad685877682058b8a1f1527f5459f3484835..00f99e0a09b1aa5bf3f05d91b4894cd1805a42e5 100644 (file)
@@ -104,6 +104,9 @@ class pkgAcqMethod
    
    pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
    virtual ~pkgAcqMethod() {};
+
+   private:
+   void Dequeue();
 };
 
 /** @} */
index f0a6aba3b68a7c1a99513915c468951a334594b1..7097a6e99380087bcf47b1c6bcf0e34425da8b20 100644 (file)
@@ -15,6 +15,8 @@ apt (0.9.4) UNRELEASED; urgency=low
   * debian/control:
     - move doxygen and debiandoc-sgml to Build-Depends-Indep as docs
       are no longer build in the same target as the manpages
+  * apt-pkg/acquire-methods.cc:
+    - factor out into private Dequeue() to fix access to deleted pointer
 
  -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 11 May 2012 23:26:59 +0200