summaryrefslogtreecommitdiff
path: root/methods/server.cc
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.cc
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.cc')
-rw-r--r--methods/server.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/methods/server.cc b/methods/server.cc
index 1c42c69c2..934ec2abe 100644
--- a/methods/server.cc
+++ b/methods/server.cc
@@ -495,10 +495,8 @@ int ServerMethod::Loop()
// Connect to the server
if (Server == 0 || Server->Comp(Queue->Uri) == false)
- {
- delete Server;
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
@@ -515,8 +513,7 @@ int ServerMethod::Loop()
if (Server->Open() == false)
{
Fail(true);
- delete Server;
- Server = 0;
+ Server = nullptr;
continue;
}
@@ -748,9 +745,7 @@ int ServerMethod::Loop()
return 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)
@@ -758,3 +753,9 @@ ServerMethod::FindMaximumObjectSizeInQueue() const
return MaxSizeInQueue;
}
/*}}}*/
+ServerMethod::ServerMethod(const char *Ver,unsigned long Flags) : /*{{{*/
+ pkgAcqMethod(Ver, Flags), Server(nullptr), File(NULL), PipelineDepth(10),
+ AllowRedirect(false), Debug(false)
+{
+}
+ /*}}}*/