mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
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 in756b46ddd2
and later47e88b33b
which added a string that needed to be copied. https://bugzilla.redhat.com/show_bug.cgi?id=1814923 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
02f909b8a6
commit
299796328c
@ -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)
|
ret->type = src->type;
|
||||||
return NULL;
|
virSecretLookupDefCopy(&ret->seclookupdef, &src->seclookupdef);
|
||||||
|
|
||||||
memcpy(ret, src, sizeof(*src));
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user