summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-09 09:57:29 +0200
committerDaniel Mack <github@zonque.org>2015-09-09 09:57:29 +0200
commit0fa7d1f5be847d4804eb3bf6a4c10333ea14e0bc (patch)
tree6afb70cc560bd94219f81495ff699c83b404e18c /src/import
parentbed2c013b6570908a114a337632000cf9c9de838 (diff)
parentece174c5439021e32ebcc858842de9586072c006 (diff)
Merge pull request #1207 from poettering/coccinelle-fixes
Coccinelle fixes
Diffstat (limited to 'src/import')
-rw-r--r--src/import/export-tar.c6
-rw-r--r--src/import/import-raw.c3
-rw-r--r--src/import/import-tar.c3
-rw-r--r--src/import/importd.c5
-rw-r--r--src/import/pull-dkr.c6
5 files changed, 7 insertions, 16 deletions
diff --git a/src/import/export-tar.c b/src/import/export-tar.c
index 5adc748c50..43fa9d1b03 100644
--- a/src/import/export-tar.c
+++ b/src/import/export-tar.c
@@ -287,8 +287,7 @@ int tar_export_start(TarExport *e, const char *path, int fd, ImportCompressType
if (r >= 0)
e->quota_referenced = q.referenced;
- free(e->temp_path);
- e->temp_path = NULL;
+ e->temp_path = mfree(e->temp_path);
r = tempfn_random(path, NULL, &e->temp_path);
if (r < 0)
@@ -298,8 +297,7 @@ int tar_export_start(TarExport *e, const char *path, int fd, ImportCompressType
r = btrfs_subvol_snapshot_fd(sfd, e->temp_path, BTRFS_SNAPSHOT_READ_ONLY|BTRFS_SNAPSHOT_RECURSIVE);
if (r < 0) {
log_debug_errno(r, "Couldn't create snapshot %s of %s, not exporting atomically: %m", e->temp_path, path);
- free(e->temp_path);
- e->temp_path = NULL;
+ e->temp_path = mfree(e->temp_path);
}
}
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index a27e81bbd4..5f7d25d063 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -249,8 +249,7 @@ static int raw_import_finish(RawImport *i) {
if (r < 0)
return log_error_errno(r, "Failed to move image into place: %m");
- free(i->temp_path);
- i->temp_path = NULL;
+ i->temp_path = mfree(i->temp_path);
return 0;
}
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index 7ffe83cc33..d2bfb30238 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -205,8 +205,7 @@ static int tar_import_finish(TarImport *i) {
if (r < 0)
return log_error_errno(r, "Failed to move image into place: %m");
- free(i->temp_path);
- i->temp_path = NULL;
+ i->temp_path = mfree(i->temp_path);
return 0;
}
diff --git a/src/import/importd.c b/src/import/importd.c
index ffff94ee72..b91300a5df 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -600,12 +600,9 @@ static int manager_on_notify(sd_event_source *s, int fd, uint32_t revents, void
cmsg_close_all(&msghdr);
CMSG_FOREACH(cmsg, &msghdr) {
- if (cmsg->cmsg_level == SOL_SOCKET &&
- cmsg->cmsg_type == SCM_CREDENTIALS &&
- cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred))) {
+ if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDENTIALS && cmsg->cmsg_len == CMSG_LEN(sizeof(struct ucred)))
ucred = (struct ucred*) CMSG_DATA(cmsg);
- }
}
if (msghdr.msg_flags & MSG_TRUNC) {
diff --git a/src/import/pull-dkr.c b/src/import/pull-dkr.c
index 5ff49baa22..0dab184af1 100644
--- a/src/import/pull-dkr.c
+++ b/src/import/pull-dkr.c
@@ -1211,10 +1211,8 @@ static void dkr_pull_job_on_finished(PullJob *j) {
log_info("Completed writing to layer %s.", i->final_path);
i->layer_job = pull_job_unref(i->layer_job);
- free(i->temp_path);
- i->temp_path = NULL;
- free(i->final_path);
- i->final_path = NULL;
+ i->temp_path = mfree(i->temp_path);
+ i->final_path = mfree(i->final_path);
i->current_ancestry ++;
r = dkr_pull_pull_layer(i);