提交 9e8d33ae 编写于 作者: M Michal Privoznik 提交者: Cole Robinson

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: NMichal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 349badbf)
上级 3feb8fb7
......@@ -2274,6 +2274,8 @@ virStorageSourceClear(virStorageSourcePtr def)
VIR_FREE(def->nodeformat);
virStorageSourceBackingStoreClear(def);
memset(def, 0, sizeof(*def));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册