Re: [PATCH v4 7/9] qemu: Introduce qemuBuildChrDeviceStr

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

 



On 07/10/2013 01:02 PM, Michal Privoznik wrote:
> The function being introduced is responsible for creating command
> line argument for '-device' for given character device. Based on
> the chardev type, it calls appropriate qemuBuild.*ChrDeviceStr(),
> e.g.  qemuBuildSerialChrDeviceStr() for serial chardev and so on.
> ---
>  src/qemu/qemu_command.c | 202 +++++++++++++++++++++++++++++++++++++-----------
>  src/qemu/qemu_command.h |  12 +--
>  2 files changed, 163 insertions(+), 51 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 6cf46a2..063d76b 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -6593,6 +6593,21 @@ cleanup:
>      return ret;
>  }
>  
> +static int
> +qemuBuildChrDeviceCommandLine(virCommandPtr cmd,
> +                              virDomainDefPtr def,
> +                              virDomainChrDefPtr chr,
> +                              virQEMUCapsPtr qemuCaps)
> +{
> +    char *devstr = NULL;
> +
> +    if (qemuBuildChrDeviceStr(&devstr, def, chr, qemuCaps) < 0)
> +        return -1;
> +
> +    virCommandAddArgList(cmd, "-device", devstr, NULL);

"make -C tests valgrind" reports:

==16114== 1,100 bytes in 1 blocks are definitely lost in loss record 100 of 118
==16114==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==16114==    by 0x4A089F0: realloc (vg_replace_malloc.c:662)
==16114==    by 0x4C70BE7: virReallocN (viralloc.c:233)
==16114==    by 0x4C73BA0: virBufferGrow (virbuffer.c:129)
==16114==    by 0x4C740AE: virBufferVasprintf (virbuffer.c:321)
==16114==    by 0x4C74223: virBufferAsprintf (virbuffer.c:294)
==16114==    by 0x437DA2: qemuBuildChrDeviceStr (qemu_command.c:8547)
==16114==    by 0x438027: qemuBuildChrDeviceCommandLine (qemu_command.c:6607)
==16114==    by 0x43BAEF: qemuBuildCommandLine (qemu_command.c:7693)
==16114==    by 0x4247EC: testCompareXMLToArgvHelper (qemuxml2argvtest.c:157)
==16114==    by 0x425E97: virtTestRun (testutils.c:159)
==16114==    by 0x4205F1: mymain (qemuxml2argvtest.c:715)
==16114== 


You need a VIR_FREE(devstr);

> +    return 0;
> +}
> +


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