Re: [PATCH v2 16/32] conf: Use VIR_AUTOFREE for storage_conf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 08, 2019 at 01:37:10PM -0500, John Ferlan wrote:
Let's make use of the auto __cleanup capabilities cleaning up any
now unnecessary goto paths.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
Reviewed-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
src/conf/storage_conf.c | 179 +++++++++++++++++-----------------------
1 file changed, 74 insertions(+), 105 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 177ea63076..a2ddecf0f2 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -502,13 +502,12 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
        source->nhost = n;

        for (i = 0; i < source->nhost; i++) {
-            name = virXMLPropString(nodeset[i], "name");
-            if (name == NULL) {
+            source->hosts[i].name = virXMLPropString(nodeset[i], "name");
+            if (!source->hosts[i].name) {
                virReportError(VIR_ERR_XML_ERROR, "%s",
                               _("missing storage pool host name"));
                goto cleanup;
            }
-            source->hosts[i].name = name;

            port = virXMLPropString(nodeset[i], "port");
            if (port) {

Unrelated hunk.

To the rest:
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux