[libvirt] [PATCH 8/3] conf: avoid memory leak
Laine Stump
laine at laine.org
Tue Aug 2 20:53:26 UTC 2011
On 08/02/2011 03:50 PM, Eric Blake wrote:
> Detected by Coverity. Introduced in commit 85aa40e.
leak of meta - important point, since the thing being leaked doesn't
show up anywhere in the diff.
ACK
> * src/conf/domain_conf.c (virDomainDiskDefForeachPath): Plug leak.
> ---
> src/conf/domain_conf.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index e182cd6..010ce57 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -11315,7 +11315,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
> virDomainDiskDefPathIterator iter,
> void *opaque)
> {
> - virHashTablePtr paths;
> + virHashTablePtr paths = NULL;
> int format;
> int ret = -1;
> size_t depth = 0;
> @@ -11339,7 +11339,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
> virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> _("unknown disk format '%s' for %s"),
> disk->driverType, disk->src);
> - return -1;
> + goto cleanup;
> }
> } else {
> if (allowProbing) {
> @@ -11348,7 +11348,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
> virDomainReportError(VIR_ERR_INTERNAL_ERROR,
> _("no disk format for %s and probing is disabled"),
> disk->src);
> - return -1;
> + goto cleanup;
> }
> }
>
More information about the libvir-list
mailing list