mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virStorageSourceClear: Don't leave dangling pointers behind
Imagine that this function is called twice over the same disk
source. While in the first run all allocated memory is freed, not
all pointers are set to NULL (e.g. def->srcpool). So when called
again, these poitners are freed again resulting in double free.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 349badbffd
)
This commit is contained in:
parent
3feb8fb79d
commit
9e8d33ae1c
@ -2274,6 +2274,8 @@ virStorageSourceClear(virStorageSourcePtr def)
|
||||
VIR_FREE(def->nodeformat);
|
||||
|
||||
virStorageSourceBackingStoreClear(def);
|
||||
|
||||
memset(def, 0, sizeof(*def));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user