summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-08 18:43:11 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-09 08:19:27 +0200
commita1e58e8ee1c84b633d6d6d651d5328d4dd4eba5b (patch)
tree2c5288c0e505c561c779ea13b4d99e8101803ca2 /src/import
parentda323858ef34a0216aa96f4089810053c90f09ce (diff)
tree-wide: use coccinelle to patch a lot of code to use mfree()
This replaces this: free(p); p = NULL; by this: p = mfree(p); Change generated using coccinelle. Semantic patch is added to the sources.
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/pull-dkr.c6
4 files changed, 6 insertions, 12 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/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);