[libvirt] [PATCH] qemu_monitor_json.c: avoid many unconditional leaks

Jim Meyering jim at meyering.net
Wed Jan 27 10:17:32 UTC 2010

Daniel P. Berrange wrote:
> On Wed, Jan 27, 2010 at 10:38:55AM +0100, Jim Meyering wrote:
>> Actually, the preceding patch fixed only the one leak that had been
>> introduced in the last month or so.  Looking at the many other functions
>> that do the same sort of thing (call qemuMonitorJSONMakeCommand, and
>> later virJSONValueFree), I saw that they all had exactly the same leak.
>> So this amended patch fixes all of them:
>> >From 28f820354dcae9950cad042ea78a893fd9475830 Mon Sep 17 00:00:00 2001
>> From: Jim Meyering <meyering at redhat.com>
>> Date: Wed, 27 Jan 2010 09:58:12 +0100
>> Subject: [PATCH] qemu_monitor_json.c: avoid many unconditional leaks
> The real bug is the virJSONValueFree() itself which is missing
> the final VIR_FREE(value) call. By doing the free in the caller, we
> still leak data for compound array/hash values.

Putting the VIR_FREE in virJSONValueFree was my first reflex, too,
but since coverity detected no leak for the adjacent
"virJSONValueFree(reply);" use, I assumed that doing so would
cause a problem:


More information about the libvir-list mailing list