[libvirt] [PATCH 03/19] domain_conf: Resolve Coverity RESOURCE_LEAK

Ján Tomko jtomko at redhat.com
Thu Aug 28 08:48:50 UTC 2014


On 08/27/2014 10:54 PM, John Ferlan wrote:
> Resolve a few RESOURCE_LEAK's identified by Coverity
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/domain_conf.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 48afb8c..c7dbc73 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -5654,7 +5654,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
>                      }
>                      VIR_FREE(ready);
>                  }
> -            } else if (xmlStrEqual(cur->name, BAD_CAST "auth")) {
> +            } else if (!authdef &&
> +                       xmlStrEqual(cur->name, BAD_CAST "auth")) {
>                  if (!(authdef = virStorageAuthDefParse(node->doc, cur)))
>                      goto error;
>                  if ((auth_secret_usage =
> @@ -12069,15 +12070,17 @@ virDomainDefParseXML(xmlDocPtr xml,
>              goto error;
>          }
>  
> -        if (vcpupin->vcpuid >= def->vcpus)
> +        if (vcpupin->vcpuid >= def->vcpus) {
>              /* To avoid the regression when daemon loading
>               * domain confs, we can't simply error out if
>               * <vcpupin> nodes greater than current vcpus,
>               * ignoring them instead.
>               */
>              VIR_WARN("Ignore vcpupin for not onlined vcpus");
> -        else
> +            VIR_FREE(vcpupin);

virDomainVcpuPinDefFree should be used here as well as in the 'duplicate
vcpupin' case a few lines above.

ACK with that fixed.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140828/cf60bd6f/attachment-0001.sig>


More information about the libvir-list mailing list