[PATCH 04/19] util: add conn != NULL precondition in virGDBusCallMethod()

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

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>

Helps avoid/debug a potential SEGV if conn is NULL, since gio will not
set the "gerror" in that case and we will crash later at:
  virReportError(VIR_ERR_DBUS_SERVICE, "%s", gerror->message);

Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
 src/util/virgdbus.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/util/virgdbus.c b/src/util/virgdbus.c
index 71ca3cd43b..5e11a95106 100644
--- a/src/util/virgdbus.c
+++ b/src/util/virgdbus.c
@@ -213,6 +213,8 @@ virGDBusCallMethod(GDBusConnection *conn,
     g_autoptr(GVariant) ret = NULL;
     g_autoptr(GError) gerror = NULL;
 
+    g_return_val_if_fail(conn != NULL, -1);
+
     if (error)
         memset(error, 0, sizeof(*error));
 
@@ -268,6 +270,8 @@ virGDBusCallMethodWithFD(GDBusConnection *conn,
     g_autoptr(GVariant) ret = NULL;
     g_autoptr(GError) gerror = NULL;
 
+    g_return_val_if_fail(conn != NULL, -1);
+
     if (error)
         memset(error, 0, sizeof(*error));
 
-- 
2.47.0




[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