提交 29979632 编写于 作者: P Peter Krempa

virStorageEncryptionSecretCopy: Properly copy internals

virStorageEncryptionSecretPtr may have a string inside it, thus we must
copy the string too. Use virSecretLookupDefCopy to do that.

Caused by non-obvious code introduced in 756b46dd and later 47e88b33
which added a string that needed to be copied.

https://bugzilla.redhat.com/show_bug.cgi?id=1814923Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 02f909b8
...@@ -85,12 +85,10 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc) ...@@ -85,12 +85,10 @@ virStorageEncryptionFree(virStorageEncryptionPtr enc)
static virStorageEncryptionSecretPtr static virStorageEncryptionSecretPtr
virStorageEncryptionSecretCopy(const virStorageEncryptionSecret *src) virStorageEncryptionSecretCopy(const virStorageEncryptionSecret *src)
{ {
virStorageEncryptionSecretPtr ret; virStorageEncryptionSecretPtr ret = g_new0(virStorageEncryptionSecret, 1);
if (VIR_ALLOC(ret) < 0)
return NULL;
memcpy(ret, src, sizeof(*src)); ret->type = src->type;
virSecretLookupDefCopy(&ret->seclookupdef, &src->seclookupdef);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册