[libvirt] [PATCHv5 01/19] util: string: Add helper to free non-NULL terminated string arrays

Eric Blake eblake at redhat.com
Thu Jun 19 22:41:34 UTC 2014


On 06/19/2014 07:59 AM, Peter Krempa wrote:
> Sometimes the length of the string list is known but the array isn't
> NULL terminated. Add helper to free the array in such cases.
> ---
>  src/libvirt_private.syms |  1 +
>  src/util/virstring.c     | 20 ++++++++++++++++++++
>  src/util/virstring.h     |  1 +
>  3 files changed, 22 insertions(+)

I'm still not fully convinced we needed this (if you ALWAYS
over-allocate the array large enough for a NULL terminator, including in
VIR_APPEND_ELEMENT and friends), but it's easier to let it in than to
force you to work around it.  I would like to see coverage added in
tests/virstringtest.c, though.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140619/e0b6dd0d/attachment-0001.sig>


More information about the libvir-list mailing list