virStorageEncryptionSecretPtr may have a string inside it, thus we must copy the string too. Use virSecretLookupDefCopy to do that.
Likely caused by 756b46ddd24. https://bugzilla.redhat.com/show_bug.cgi?id=1814923 Signed-off-by: Peter Krempa <pkre...@redhat.com> --- src/util/virstorageencryption.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c index 74836d4a00..6765fdc23a 100644 --- a/src/util/virstorageencryption.c +++ b/src/util/virstorageencryption.c @@ -85,12 +85,10 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc) static virStorageEncryptionSecretPtr virStorageEncryptionSecretCopy(const virStorageEncryptionSecret *src) { - virStorageEncryptionSecretPtr ret; - - if (VIR_ALLOC(ret) < 0) - return NULL; + virStorageEncryptionSecretPtr ret = g_new0(virStorageEncryptionSecret, 1); - memcpy(ret, src, sizeof(*src)); + ret->type = src->type; + virSecretLookupDefCopy(&ret->seclookupdef, &src->seclookupdef); return ret; } -- 2.24.1