On 02/05/2014 02:14 PM, John Ferlan wrote:
On 02/04/2014 10:24 AM, Boris Fiuczynski wrote:
> On 01/22/2014 08:30 PM, John Ferlan wrote:
<...snip...>
>> @@ -2798,7 +2801,8 @@ static CMPIStatus update_system_settings(const CMPIContext
*context,
>> }
>>
>> if ((dominfo->uuid == NULL) || (STREQ(dominfo->uuid,
""))) {
>> - dominfo->uuid = strdup(uuid);
>> + dominfo->uuid = uuid;
>> + uuid = NULL;
> I am getting a compile error here and below for the free of uuid.
> error: assignment discards 'const' qualifier from pointer target type
> [-Werror]
> error: passing argument 1 of 'free' discards 'const' qualifier from
> pointer target type [-Werror]
>
> Removing the const in the declaration works... for me.
>
Strange - mine didn't complain, but one would also think that the prior
code doing a uuid = strdup(dominfo->uuid); would elicit the same issue!
Anyway, adjusted the definition from "const char *uuid" to just "char
*uuid".
In actually reading and thinking about the code, do you think a
"free(dominfo->uuid);" prior to the setting should be added too? In the
event it was the empty string? Not sure how it gets set that way, but
since cleanup_dominfo() would free() it if it was "" or whatever real
value is, then I suppose better safe than sorry.
Yeah, to be 100% sure I guess just
freeing it is ok... :-)
Tks,
John
>> } else if (!STREQ(uuid, dominfo->uuid)) {
>> cu_statusf(_BROKER, &s,
>> CMPI_RC_ERR_FAILED,
>> @@ -2829,6 +2833,7 @@ static CMPIStatus update_system_settings(const CMPIContext
*context,
>> }
>>
>> out:
>> + free(uuid);
>> free(xml);
>> virDomainFree(dom);
>> virConnectClose(conn);
>>
>
>
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Mit freundlichen Grüßen/Kind regards
Boris Fiuczynski
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294