summaryrefslogtreecommitdiffstats
path: root/lib/format_text/archiver.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/format_text/archiver.c')
-rw-r--r--lib/format_text/archiver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/format_text/archiver.c b/lib/format_text/archiver.c
index 3d33e242..e3e9fe05 100644
--- a/lib/format_text/archiver.c
+++ b/lib/format_text/archiver.c
@@ -289,7 +289,9 @@ struct volume_group *backup_read_vg(struct cmd_context *cmd,
break;
}
- tf->fmt->ops->destroy_instance(tf);
+ if (!vg)
+ tf->fmt->ops->destroy_instance(tf);
+
return vg;
}
@@ -401,6 +403,7 @@ int backup_to_file(const char *file, const char *desc, struct volume_group *vg)
if (!dm_list_size(&tf->metadata_areas_in_use)) {
log_error(INTERNAL_ERROR "No in use metadata areas to write.");
+ tf->fmt->ops->destroy_instance(tf);
return 0;
}