diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 43b7a5a7add8107d9e27e71e56f0bb9bd1f657ea..0792dd8f8a390d6b02802e54b4c478bc2bd40545 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -805,7 +805,8 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta, crypt_format = virReadBufInt32BE(buf + fileTypeInfo[meta->format].qcowCryptOffset); - if (crypt_format && VIR_ALLOC(meta->encryption) < 0) + if (crypt_format && !meta->encryption && + VIR_ALLOC(meta->encryption) < 0) goto cleanup; }