diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c9b6187fc724e5e5222d0750a0033ea6187def64..770c00bbb3a45150b98f6811e827746608faee56 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -848,7 +848,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; }