summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-01-15 21:22:27 +0100
committerLennart Poettering <lennart@poettering.net>2021-01-19 18:29:59 +0100
commit8bc3f0b89f8bdf292a2d76108d45b7d5c29d145f (patch)
tree58576b05648d3e514e8565b4cb8d7b380eccc046
parentf14717a7e2d9331010a091baeae6cf9e99f4bb5c (diff)
downloadsystemd-8bc3f0b89f8bdf292a2d76108d45b7d5c29d145f.tar.gz
import: reset PullJob properly
Properly reset all fields that have to do with the current GET job when we restart things. Previously we freed/reset only some stuff, leaking some memory even.
-rw-r--r--src/import/pull-job.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/import/pull-job.c b/src/import/pull-job.c
index 2f6bca8336..b5fb0193ec 100644
--- a/src/import/pull-job.c
+++ b/src/import/pull-job.c
@@ -72,11 +72,30 @@ static int pull_job_restart(PullJob *j, const char *new_url) {
return r;
j->state = PULL_JOB_INIT;
+ j->error = 0;
j->payload = mfree(j->payload);
j->payload_size = 0;
j->payload_allocated = 0;
j->written_compressed = 0;
j->written_uncompressed = 0;
+ j->content_length = UINT64_MAX;
+ j->etag = mfree(j->etag);
+ j->etag_exists = false;
+ j->mtime = 0;
+ j->checksum = mfree(j->checksum);
+
+ curl_glue_remove_and_free(j->glue, j->curl);
+ j->curl = NULL;
+
+ curl_slist_free_all(j->request_header);
+ j->request_header = NULL;
+
+ import_compress_free(&j->compress);
+
+ if (j->checksum_context) {
+ gcry_md_close(j->checksum_context);
+ j->checksum_context = NULL;
+ }
r = pull_job_begin(j);
if (r < 0)