From: Peter Krempa <pkrempa(a)redhat.com>
Since the 'compat' field is set based on qcow2 features it belongs to
the qcow2 code rather than to the main metadata probing function.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/storage_file/storage_file_probe.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/storage_file/storage_file_probe.c
b/src/storage_file/storage_file_probe.c
index 73751c7a2f..9fcc052ea3 100644
--- a/src/storage_file/storage_file_probe.c
+++ b/src/storage_file/storage_file_probe.c
@@ -579,6 +579,7 @@ qcow2GetFeatures(virStorageSource *meta,
int version = virReadBufInt32BE(buf + QCOWX_HDR_VERSION);
g_clear_pointer(&meta->features, virBitmapFree);
+ g_clear_pointer(&meta->compat, g_free);
if (version == 2)
return 0;
@@ -587,6 +588,7 @@ qcow2GetFeatures(virStorageSource *meta,
return -1;
meta->features = virBitmapNew(VIR_STORAGE_FILE_FEATURE_LAST);
+ meta->compat = g_strdup("1.1");
qcow2GetFeaturesProcessGroup(virReadBufInt64BE(buf +
QCOW2v3_HDR_FEATURES_COMPATIBLE),
qcow2CompatibleFeatureArray,
@@ -997,10 +999,6 @@ virStorageFileProbeGetMetadata(virStorageSource *meta,
buf, len);
}
- VIR_FREE(meta->compat);
- if (meta->format == VIR_STORAGE_FILE_QCOW2 && meta->features)
- meta->compat = g_strdup("1.1");
-
return 0;
}
--
2.49.0