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>
*/
void virBufferFreeAndReset(virBufferPtr buf)
{
- char *str = virBufferContentAndReset(buf);
-
- VIR_FREE(str);
+ if (buf)
+ virBufferSetError(buf, 0);
}
/**