[Libvirt-cim] [PATCH] [CU][RFC] Correct a few API issues

Dan Smith danms at us.ibm.com
Tue Nov 27 21:49:24 UTC 2007


JG> My guess is that adding the const makes it so that callers can't
JG> modify the resulting string, 

Right, which makes free() choke on it, thus indicating all the
free()'s that I needed to remove in this case :)

JG> which means that we can just hand them all pointers to the same
JG> string, so there is no need to strdup, so they don't have to free?

No.  The const doesn't really have anything to do with not needing to
free() it.  The reason it doesn't need to be free()'d is because it's
memory from a broker-managed object, which will be freed when the
current provider returns back to the CIMOM.  The same reason you don't
need to free() a CMPIInstance or CMPIObjectPath.

-- 
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/20071127/7279aab0/attachment.sig>


More information about the Libvirt-cim mailing list