Re: [PATCH] virDomainHostdevSubsysSCSIVHostDefParseXML: Don't leak @wwpn

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

 



On Fri, Jan 20, 2017 at 15:53:18 +0100, Michal Privoznik wrote:

In subject. In fact actually 'protocol' was leaked.

> ==24748== 12 bytes in 2 blocks are definitely lost in loss record 25 of 84
> ==24748==    at 0x4C2BF80: malloc (vg_replace_malloc.c:296)
> ==24748==    by 0x1A1E1E78: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4)
> ==24748==    by 0x18D0495F: virXMLPropString (virxml.c:506)
> ==24748==    by 0x18D1FB3E: virDomainHostdevSubsysSCSIVHostDefParseXML (domain_conf.c:6280)
> ==24748==    by 0x18D20350: virDomainHostdevDefParseXMLSubsys (domain_conf.c:6450)
> ==24748==    by 0x18D34E7D: virDomainHostdevDefParseXML (domain_conf.c:13218)
> ==24748==    by 0x18D42598: virDomainDefParseXML (domain_conf.c:17745)
> ==24748==    by 0x18D440A9: virDomainDefParseNode (domain_conf.c:18236)
> ==24748==    by 0x18D43EFA: virDomainDefParse (domain_conf.c:18180)
> ==24748==    by 0x18D43FA0: virDomainDefParseFile (domain_conf.c:18206)
> ==24748==    by 0x44EDA1: testCompareDomXML2XMLFiles (testutils.c:1140)
> ==24748==    by 0x4365F8: testXML2XMLActive (qemuxml2xmltest.c:59)
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 52aee2b02..55d2c25b2 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -6274,13 +6274,14 @@ static int
>  virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode,
>                                             virDomainHostdevDefPtr def)
>  {
> -    char *protocol = NULL;
> +    char *protocol = NULL, *wwpn = NULL;

Only one variable per line please.

>      virDomainHostdevSubsysSCSIVHostPtr hostsrc = &def->source.subsys.u.scsi_host;
> +    int ret = -1;
>  
>      if (!(protocol = virXMLPropString(sourcenode, "protocol"))) {
>          virReportError(VIR_ERR_XML_ERROR, "%s",
>                         _("Missing scsi_host subsystem protocol"));
> -        return -1;
> +        return ret;

This is not necessary.

>      }
>  
>      if ((hostsrc->protocol =

ACK iff you fix the commit message and the variable declaration.

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]
  Powered by Linux