mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
virBuffer: Try harder to free buffer
Currently, the way virBufferFreeAndReset() works is it relies on virBufferContentAndReset() to fetch the buffer content which is then freed. This works as long as there is no bug in virBuffer* implementation (not true apparently). Explicitly call free() over buffer content. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
39d4f78a8e
commit
14b74ab625
@ -281,9 +281,8 @@ virBufferContentAndReset(virBufferPtr buf)
|
||||
*/
|
||||
void virBufferFreeAndReset(virBufferPtr buf)
|
||||
{
|
||||
char *str = virBufferContentAndReset(buf);
|
||||
|
||||
VIR_FREE(str);
|
||||
if (buf)
|
||||
virBufferSetError(buf, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user