[PATCH] qemu: Drop NULL checks guarding g_slist_free_full()

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

 



The g_slist_free_full() function is perfectly capable of handling
NULL (in which case it's NOP), therefore there's no need to check
passed pointers for NULL. We have them though in couple of
places. Drop them.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c           |  8 +++-----
 src/qemu/qemu_migration_cookie.c | 10 ++++------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c3afc6c9d3..09e213e48d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -103,9 +103,8 @@ qemuJobFreePrivate(void *opaque)
         return;
 
     qemuMigrationParamsFree(priv->migParams);
-    if (priv->migTempBitmaps)
-        g_slist_free_full(priv->migTempBitmaps,
-                          (GDestroyNotify) qemuDomainJobPrivateMigrateTempBitmapFree);
+    g_slist_free_full(priv->migTempBitmaps,
+                      (GDestroyNotify) qemuDomainJobPrivateMigrateTempBitmapFree);
     g_free(priv);
 }
 
@@ -1733,8 +1732,7 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivate *priv)
 
     priv->dbusDaemonRunning = false;
 
-    if (priv->dbusVMStateIds)
-        g_slist_free_full(g_steal_pointer(&priv->dbusVMStateIds), g_free);
+    g_slist_free_full(g_steal_pointer(&priv->dbusVMStateIds), g_free);
 
     priv->dbusVMState = false;
 
diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_cookie.c
index 95e803b3e1..4d070e438d 100644
--- a/src/qemu/qemu_migration_cookie.c
+++ b/src/qemu/qemu_migration_cookie.c
@@ -139,9 +139,8 @@ qemuMigrationBlockDirtyBitmapsDiskFree(qemuMigrationBlockDirtyBitmapsDisk *dsk)
         return;
 
     g_free(dsk->target);
-    if (dsk->bitmaps)
-        g_slist_free_full(dsk->bitmaps,
-                          (GDestroyNotify) qemuMigrationBlockDirtyBitmapsDiskBitmapFree);
+    g_slist_free_full(dsk->bitmaps,
+                      (GDestroyNotify) qemuMigrationBlockDirtyBitmapsDiskBitmapFree);
     g_free(dsk);
 }
 
@@ -168,9 +167,8 @@ qemuMigrationCookieFree(qemuMigrationCookie *mig)
     g_clear_pointer(&mig->jobData, virDomainJobDataFree);
     virCPUDefFree(mig->cpu);
     qemuMigrationCookieCapsFree(mig->caps);
-    if (mig->blockDirtyBitmaps)
-        g_slist_free_full(mig->blockDirtyBitmaps,
-                          (GDestroyNotify) qemuMigrationBlockDirtyBitmapsDiskFree);
+    g_slist_free_full(mig->blockDirtyBitmaps,
+                      (GDestroyNotify) qemuMigrationBlockDirtyBitmapsDiskFree);
     g_free(mig);
 }
 
-- 
2.37.4




[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