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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
>> 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:

    virJSONValueFree(cmd);
    VIR_FREE(cmd);
    virJSONValueFree(reply);

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]