summaryrefslogtreecommitdiff
path: root/methods/server.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-09-11 21:02:19 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-09-14 15:22:18 +0200
commit830a1b8c9e9a26dc1101167ac66a75c444902c4d (patch)
treec8846c6a98eb81e95d0b4459b146d8075b7f0913 /methods/server.h
parentae732225ec2fa0d7434c9f40a92ced8683752211 (diff)
fix two memory leaks reported by gcc
Reported-By: gcc -fsanitize=address -fno-sanitize=vptr Git-Dch: Ignore
Diffstat (limited to 'methods/server.h')
-rw-r--r--methods/server.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/methods/server.h b/methods/server.h
index f9f6e9071..5de7686d9 100644
--- a/methods/server.h
+++ b/methods/server.h
@@ -17,6 +17,7 @@
#include <time.h>
#include <iostream>
#include <string>
+#include <memory>
using std::cout;
using std::endl;
@@ -108,7 +109,7 @@ class ServerMethod : public pkgAcqMethod
protected:
virtual bool Fetch(FetchItem *) APT_OVERRIDE;
- ServerState *Server;
+ std::unique_ptr<ServerState> Server;
std::string NextURI;
FileFd *File;
@@ -152,10 +153,10 @@ class ServerMethod : public pkgAcqMethod
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;
- 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() {};
};