HE> dom = virDomainLookupByName(conn, name);
HE> - if (dom == NULL)
HE> - goto out;
HE> -
HE> - inst = get_vssd_instance(dom, _BROKER, reference);
HE> -
HE> + if (dom == NULL) {
HE> + cu_statusf(broker, &s,
HE> + CMPI_RC_ERR_NOT_FOUND,
HE> + "No such instance (%s)",
HE> + name);
HE> + goto out;
I think you leak dom here, since you moved the virDomainFree before
the out target:
HE> + }
HE> +
HE> + *_inst = _get_vssd(broker, reference, conn, dom, &s);
HE> +
HE> + virDomainFree(dom);
HE> +
HE> out:
HE> virConnectClose(conn);
HE> - virDomainFree(dom);
HE> -
HE> - return inst;
HE> +
HE> + return s;
HE> +}
...
HE> +CMPIStatus get_vssd_by_ref(const CMPIBroker *broker,
HE> + const CMPIObjectPath *reference,
HE> + CMPIInstance **_inst)
HE> +{
HE> + CMPIStatus s = {CMPI_RC_OK, NULL};
HE> + char *name = NULL;
HE> +
HE> + if (!parse_instanceid(reference, NULL, &name)) {
HE> + cu_statusf(broker, &s,
HE> + CMPI_RC_ERR_NOT_FOUND,
HE> + "No such instance (InstanceID)");
HE> + goto out;
HE> + }
HE> +
HE> + s = get_vssd_by_name(broker, reference, name, _inst);
HE> + if (s.rc != CMPI_RC_OK)
HE> + goto out;
You leak name here because the free is before the out:
HE> +
HE> + s = cu_validate_ref(broker, reference, *_inst);
HE> +
HE> + free(name);
HE> +
HE> + out:
HE> + return s;
HE> }
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com