diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-05-14 16:53:43 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-05-14 16:53:43 +0200 |
commit | e1284a59de37efeedcc998ef61e8466c35b82eb2 (patch) | |
tree | b1fcf0410eb37eed5cc7cbd78703f21ad3d2efdf /apt-pkg | |
parent | b65d5efc0c4097f76d18f9ac737e57b14fe6ec90 (diff) |
* apt-pkg/acquire-methods.cc:
- factor out into private Dequeue() to fix access to deleted pointer
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-method.cc | 23 | ||||
-rw-r--r-- | apt-pkg/acquire-method.h | 3 |
2 files changed, 13 insertions, 13 deletions
diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index 2041fd9e9..e6e02bbc5 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -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; +} + /*}}}*/ diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 2dd9ad685..00f99e0a0 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -104,6 +104,9 @@ class pkgAcqMethod pkgAcqMethod(const char *Ver,unsigned long Flags = 0); virtual ~pkgAcqMethod() {}; + + private: + void Dequeue(); }; /** @} */ |