mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +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
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user