Re: [PATCH 2/2] virLogManagerDomainReadLogFile: Don't do dummy allocs

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

 



On Mon, Jan 18, 2016 at 11:39:35AM +0100, Michal Privoznik wrote:
Since we pass a dummy variables @fdout and @fdoutlen into

s/a //

virNetClientProgramCall() we make it alloc @fdout array (even
though it's array of 0 elements since vitlogd can hardly pass us

s/array/an array/

And moreover, they are named fdout and fdoutlen, but we were passing
them as ninfds and infds.  But I don't think we need to describe all of
that, it's just the reason why they were allocated.

some FDs at this stage). Nevertheless, it's an allocation not
followed by free():

==29385== 0 bytes in 60 blocks are definitely lost in loss record 2 of 1,009
==29385==    at 0x4C2C070: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29385==    by 0x54B99EF: virAllocN (viralloc.c:191)
==29385==    by 0x56821B1: virNetClientProgramCall (virnetclientprogram.c:359)
==29385==    by 0x563B304: virLogManagerDomainReadLogFile (log_manager.c:272)
==29385==    by 0x217CD613: qemuDomainLogContextRead (qemu_domain.c:2485)
==29385==    by 0x217EDC76: qemuProcessReadLog (qemu_process.c:1660)
==29385==    by 0x217EDE1D: qemuProcessReportLogError (qemu_process.c:1696)
==29385==    by 0x217EE8C1: qemuProcessWaitForMonitor (qemu_process.c:1957)
==29385==    by 0x217F6636: qemuProcessLaunch (qemu_process.c:4955)
==29385==    by 0x217F71A4: qemuProcessStart (qemu_process.c:5152)
==29385==    by 0x21846582: qemuDomainObjStart (qemu_driver.c:7396)
==29385==    by 0x218467DE: qemuDomainCreateWithFlags (qemu_driver.c:7450)

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/logging/log_manager.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c
index 290e2c8..a9c9e72 100644
--- a/src/logging/log_manager.c
+++ b/src/logging/log_manager.c
@@ -256,8 +256,6 @@ virLogManagerDomainReadLogFile(virLogManagerPtr mgr,
{
    struct virLogManagerProtocolDomainReadLogFileArgs args;
    struct virLogManagerProtocolDomainReadLogFileRet ret;
-    int *fdout = NULL;
-    size_t fdoutlen = 0;
    char *rv = NULL;

    memset(&args, 0, sizeof(args));
@@ -273,7 +271,7 @@ virLogManagerDomainReadLogFile(virLogManagerPtr mgr,
                                mgr->client,
                                mgr->serial++,
                                VIR_LOG_MANAGER_PROTOCOL_PROC_DOMAIN_READ_LOG_FILE,
-                                0, NULL, &fdoutlen, &fdout,
+                                0, NULL, 0, NULL,

Anyway, the 7th parameter is a pointer to size_t, so it should rather be
NULL, hence making this whole line a "0, NULL, NULL, NULL,".  ACK with
that changed.

                                (xdrproc_t)xdr_virLogManagerProtocolDomainReadLogFileArgs, &args,
                                (xdrproc_t)xdr_virLogManagerProtocolDomainReadLogFileRet, &ret) < 0)
        goto cleanup;
--
2.4.10

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

Attachment: signature.asc
Description: PGP signature

--
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]