Reported-By: gcc -fsanitize=address -fno-sanitize=vptr
Git-Dch: Ignore
metaIndex::~metaIndex()
{
metaIndex::~metaIndex()
{
- if (Indexes == 0)
- return;
- for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
- I != (*Indexes).end(); ++I)
- delete *I;
- delete Indexes;
+ if (Indexes != 0)
+ {
+ for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
+ I != (*Indexes).end(); ++I)
+ delete *I;
+ delete Indexes;
+ }
+ for (auto const &E: Entries)
+ delete E.second;
}
// one line Getters for public fields /*{{{*/
}
// one line Getters for public fields /*{{{*/
-ServerState * HttpMethod::CreateServerState(URI uri) /*{{{*/
+std::unique_ptr<ServerState> HttpMethod::CreateServerState(URI const &uri)/*{{{*/
- return new HttpServerState(uri, this);
+ return std::unique_ptr<ServerState>(new HttpServerState(uri, this));
}
/*}}}*/
void HttpMethod::RotateDNS() /*{{{*/
}
/*}}}*/
void HttpMethod::RotateDNS() /*{{{*/
virtual bool Configuration(std::string Message) APT_OVERRIDE;
virtual bool Configuration(std::string Message) APT_OVERRIDE;
- virtual ServerState * CreateServerState(URI uri) APT_OVERRIDE;
+ virtual std::unique_ptr<ServerState> CreateServerState(URI const &uri) APT_OVERRIDE;
virtual void RotateDNS() APT_OVERRIDE;
protected:
virtual void RotateDNS() APT_OVERRIDE;
protected:
-ServerState * HttpsMethod::CreateServerState(URI uri) /*{{{*/
+std::unique_ptr<ServerState> HttpsMethod::CreateServerState(URI const &uri)/*{{{*/
- return new HttpsServerState(uri, this);
+ return std::unique_ptr<ServerState>(new HttpsServerState(uri, this));
#include <iostream>
#include <stddef.h>
#include <string>
#include <iostream>
#include <stddef.h>
#include <string>
double ultotal, double ulnow);
void SetupProxy();
CURL *curl;
double ultotal, double ulnow);
void SetupProxy();
CURL *curl;
+ std::unique_ptr<ServerState> Server;
// Used by ServerMethods unused by https
virtual void SendReq(FetchItem *) APT_OVERRIDE { exit(42); }
// Used by ServerMethods unused by https
virtual void SendReq(FetchItem *) APT_OVERRIDE { exit(42); }
FileFd *File;
virtual bool Configuration(std::string Message) APT_OVERRIDE;
FileFd *File;
virtual bool Configuration(std::string Message) APT_OVERRIDE;
- virtual ServerState * CreateServerState(URI uri) APT_OVERRIDE;
+ virtual std::unique_ptr<ServerState> CreateServerState(URI const &uri) APT_OVERRIDE;
using pkgAcqMethod::FetchResult;
using pkgAcqMethod::FetchItem;
using pkgAcqMethod::FetchResult;
using pkgAcqMethod::FetchItem;
// Connect to the server
if (Server == 0 || Server->Comp(Queue->Uri) == false)
// Connect to the server
if (Server == 0 || Server->Comp(Queue->Uri) == false)
Server = CreateServerState(Queue->Uri);
Server = CreateServerState(Queue->Uri);
/* If the server has explicitly said this is the last connection
then we pre-emptively shut down the pipeline and tear down
the connection. This will speed up HTTP/1.0 servers a tad
/* If the server has explicitly said this is the last connection
then we pre-emptively shut down the pipeline and tear down
the connection. This will speed up HTTP/1.0 servers a tad
if (Server->Open() == false)
{
Fail(true);
if (Server->Open() == false)
{
Fail(true);
- delete Server;
- Server = 0;
- /*{{{*/
-unsigned long long
-ServerMethod::FindMaximumObjectSizeInQueue() const
+unsigned long long ServerMethod::FindMaximumObjectSizeInQueue() const /*{{{*/
{
unsigned long long MaxSizeInQueue = 0;
for (FetchItem *I = Queue; I != 0 && I != QueueBack; I = I->Next)
{
unsigned long long MaxSizeInQueue = 0;
for (FetchItem *I = Queue; I != 0 && I != QueueBack; I = I->Next)
return MaxSizeInQueue;
}
/*}}}*/
return MaxSizeInQueue;
}
/*}}}*/
+ServerMethod::ServerMethod(const char *Ver,unsigned long Flags) : /*{{{*/
+ pkgAcqMethod(Ver, Flags), Server(nullptr), File(NULL), PipelineDepth(10),
+ AllowRedirect(false), Debug(false)
+{
+}
+ /*}}}*/
#include <time.h>
#include <iostream>
#include <string>
#include <time.h>
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using std::cout;
using std::endl;
protected:
virtual bool Fetch(FetchItem *) APT_OVERRIDE;
protected:
virtual bool Fetch(FetchItem *) APT_OVERRIDE;
+ std::unique_ptr<ServerState> Server;
std::string NextURI;
FileFd *File;
std::string NextURI;
FileFd *File;
int Loop();
virtual void SendReq(FetchItem *Itm) = 0;
int Loop();
virtual void SendReq(FetchItem *Itm) = 0;
- virtual ServerState * CreateServerState(URI uri) = 0;
+ virtual std::unique_ptr<ServerState> CreateServerState(URI const &uri) = 0;
virtual void RotateDNS() = 0;
virtual void RotateDNS() = 0;
- ServerMethod(const char *Ver,unsigned long Flags = 0) : pkgAcqMethod(Ver, Flags), Server(NULL), File(NULL), PipelineDepth(10), AllowRedirect(false), Debug(false) {};
+ ServerMethod(const char *Ver,unsigned long Flags = 0);
virtual ~ServerMethod() {};
};
virtual ~ServerMethod() {};
};