[Libvirt-cim] [PATCH 2 of 3] Adoption of changes to RegisteredProfile

Dan Smith danms at us.ibm.com
Mon Nov 26 16:08:19 UTC 2007


HE> diff -r a479cec9721a -r 50b0c2bad1e3 src/Virt_ElementConformsToProfile.c
HE> --- a/src/Virt_ElementConformsToProfile.c	Fri Nov 23 11:05:44 2007 +0100
HE> +++ b/src/Virt_ElementConformsToProfile.c	Fri Nov 23 11:05:46 2007 +0100
HE> @@ -133,9 +133,14 @@ static CMPIStatus elem_to_prof(const CMP
HE>  {
HE>          CMPIStatus s = {CMPI_RC_OK, NULL};
HE>          CMPIInstance *instance;
HE> +        virConnectPtr conn = NULL;

You add a virConnectPtr here,

HE> +        struct reg_prof *candidate;
HE>          char *classname;
HE> -        struct reg_prof *candidate;
HE>          int i;
HE> +
HE> +        conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
HE> +        if (conn == NULL)
HE> +                goto out;

and open it here,

HE>          classname = class_base_name(CLASSNAME(ref));
HE>          if (classname == NULL) {
HE> @@ -151,10 +156,12 @@ static CMPIStatus elem_to_prof(const CMP

HE>                  instance = reg_prof_instance(_BROKER, 
HE>                                               "/root/interop", 
HE> -                                             NULL, 
HE> +                                             NULL,
HE> +                                             conn,
HE>                                               candidate);
HE>                  if (instance == NULL) {
HE> -                        CMSetStatusWithChars(_BROKER, &s, CMPI_RC_ERR_FAILED,
HE> +                        CMSetStatusWithChars(_BROKER, &s, 
HE> +                                             CMPI_RC_ERR_FAILED,
HE>                                               "Can't create profile instance.");
HE>                          goto error;
HE>                  }


But I don't see you close it anywhere before you exit the function, so
I think this leaks the connection.

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071126/dfdfc565/attachment.sig>


More information about the Libvirt-cim mailing list