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 | |
parent | b65d5efc0c4097f76d18f9ac737e57b14fe6ec90 (diff) |
* apt-pkg/acquire-methods.cc:
- factor out into private Dequeue() to fix access to deleted pointer
-rw-r--r-- | apt-pkg/acquire-method.cc | 23 | ||||
-rw-r--r-- | apt-pkg/acquire-method.h | 3 | ||||
-rw-r--r-- | debian/changelog | 2 |
3 files changed, 15 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(); }; /** @} */ diff --git a/debian/changelog b/debian/changelog index f0a6aba3b..7097a6e99 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 |