render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
6d3351
From 422a658bac7ffade2ac2bffb44dbe0b99919c224 Mon Sep 17 00:00:00 2001
6d3351
Message-Id: <422a658bac7ffade2ac2bffb44dbe0b99919c224@dist-git>
6d3351
From: Erik Skultety <eskultet@redhat.com>
6d3351
Date: Thu, 4 May 2017 13:49:59 +0200
6d3351
Subject: [PATCH] util: mdev: Use a local variable instead of a direct pointer
6d3351
 access
6d3351
6d3351
Use a local variable to hold data, rather than accessing the pointer
6d3351
after calling virMediatedDeviceListAdd (therefore VIR_APPEND_ELEMENT).
6d3351
Although not causing an issue at the moment, this change is a necessary
6d3351
prerequisite for tweaking virMediatedDeviceListAdd in a separate patch,
6d3351
which will take a reference for the source pointer (instead of pointer
6d3351
value) and will clear it along the way.
6d3351
6d3351
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6d3351
Reviewed-by: Laine Stump <laine@laine.org>
6d3351
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
6d3351
6d3351
https://bugzilla.redhat.com/show_bug.cgi?id=1446455
6d3351
(cherry picked from commit 2739a983f235f0d92d210800d61bd1a195f01850)
6d3351
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6d3351
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
6d3351
---
6d3351
 src/util/virmdev.c | 5 +++--
6d3351
 1 file changed, 3 insertions(+), 2 deletions(-)
6d3351
6d3351
diff --git a/src/util/virmdev.c b/src/util/virmdev.c
6d3351
index 2a1ade739..c1499d238 100644
6d3351
--- a/src/util/virmdev.c
6d3351
+++ b/src/util/virmdev.c
6d3351
@@ -447,20 +447,21 @@ virMediatedDeviceListMarkDevices(virMediatedDeviceListPtr dst,
6d3351
     virObjectLock(dst);
6d3351
     for (i = 0; i < count; i++) {
6d3351
         virMediatedDevicePtr mdev = virMediatedDeviceListGet(src, i);
6d3351
+        const char *mdev_path = mdev->path;
6d3351
 
6d3351
         if (virMediatedDeviceIsUsed(mdev, dst) ||
6d3351
             virMediatedDeviceSetUsedBy(mdev, drvname, domname) < 0)
6d3351
             goto cleanup;
6d3351
 
6d3351
         /* Copy mdev references to the driver list:
6d3351
-         * - caller is responsible for NOT freeing devices in @list on success
6d3351
+         * - caller is responsible for NOT freeing devices in @src on success
6d3351
          * - we're responsible for performing a rollback on failure
6d3351
          */
6d3351
         if (virMediatedDeviceListAdd(dst, mdev) < 0)
6d3351
             goto rollback;
6d3351
 
6d3351
         VIR_DEBUG("'%s' added to list of active mediated devices used by '%s'",
6d3351
-                  mdev->path, domname);
6d3351
+                  mdev_path, domname);
6d3351
     }
6d3351
 
6d3351
     ret = 0;
6d3351
-- 
6d3351
2.13.0
6d3351