[Libvirt-cim] [PATCH 1 of 4] Add reference validation to get_migration_service()

Heidi Eckhart heidieck at linux.vnet.ibm.com
Tue Feb 19 10:42:32 UTC 2008


Kaitlin Rupert wrote:
>  static CMPIStatus return_vsms(const CMPIObjectPath *ref,
>                                const CMPIResult *results,
> -                              bool name_only)
> +                              bool name_only,
> +                              bool is_get_inst)
>  {
>          CMPIInstance *inst;
>   
The same reason here ... please init inst=NULL to avoid seg faulting the 
return instance functions.
>          CMPIStatus s;
>
> -        s = get_migration_service(ref, &inst, _BROKER);
> -        if (s.rc == CMPI_RC_OK) {
> -                if (name_only)
> -                        cu_return_instance_name(results, inst);
> -                else
> -                        CMReturnInstance(results, inst);
> -        }
> -
> +        s = get_migration_service(ref, &inst, _BROKER, is_get_inst);
> +        if ((s.rc != CMPI_RC_OK) || (inst == NULL))
> +                goto out;
> +
> +        if (name_only)
> +                cu_return_instance_name(results, inst);
> +        else
> +                CMReturnInstance(results, inst);
> + out:
>          return s;
>  }
>   


-- 
Regards

Heidi Eckhart
Software Engineer
IBM Linux Technology Center - Open Hypervisor




More information about the Libvirt-cim mailing list