1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

import: small memory management simplification

This commit is contained in:
Lennart Poettering 2021-01-15 21:23:20 +01:00
parent 8bc3f0b89f
commit 273cb07d1b

View File

@ -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.");