summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-01-15 21:23:20 +0100
committerLennart Poettering <lennart@poettering.net>2021-01-19 18:29:59 +0100
commit273cb07d1b38061f816ccac23fd583e9252430fd (patch)
tree6412f4ca86f72a9e009c8d2fed608e79335fd553 /src/import
parent8bc3f0b89f8bdf292a2d76108d45b7d5c29d145f (diff)
downloadsystemd-273cb07d1b38061f816ccac23fd583e9252430fd.tar.gz
import: small memory management simplification
Diffstat (limited to 'src/import')
-rw-r--r--src/import/pull-job.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/import/pull-job.c b/src/import/pull-job.c
index b5fb0193ec..f41a7e7a5d 100644
--- a/src/import/pull-job.c
+++ b/src/import/pull-job.c
@@ -434,10 +434,9 @@ fail:
}
static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb, void *userdata) {
+ _cleanup_free_ char *length = NULL, *last_modified = NULL, *etag = NULL;
PullJob *j = userdata;
size_t sz = size * nmemb;
- _cleanup_free_ char *length = NULL, *last_modified = NULL;
- char *etag;
int r;
assert(contents);
@@ -456,8 +455,7 @@ static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb
goto fail;
}
if (r > 0) {
- free(j->etag);
- j->etag = etag;
+ free_and_replace(j->etag, etag);
if (strv_contains(j->old_etags, j->etag)) {
log_info("Image already downloaded. Skipping download.");