[libvirt] [PATCH v2 2/4] conf: Use only one temporary string in virDomainDiskSourceParse

Ján Tomko jtomko at redhat.com
Fri May 5 11:40:01 UTC 2017


On Fri, Apr 28, 2017 at 01:10:25PM +0200, Peter Krempa wrote:
>---
> src/conf/domain_conf.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>

>@@ -7565,7 +7566,6 @@ virDomainDiskSourceParse(xmlNodePtr node,
>          * as a part of the path. This is hard to work with when dealing with
>          * relative names. Split out the volume into a separate variable */
>         if (src->path && src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER) {
>-            char *tmp;

This is not a temporary string, just a pointer into a different string
and should not be mixed up with the virXMLPropString usage.

(Maybe this code would look nicer with virStringSplit?)

Jan

>             if (!(tmp = strchr(src->path, '/')) ||
>                 tmp == src->path) {
>                 virReportError(VIR_ERR_XML_ERROR,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170505/03902eea/attachment-0001.sig>


More information about the libvir-list mailing list