[libvirt PATCH 09/12] util: firewall: use g_new0

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

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/util/virfirewall.c  | 9 +++------
 src/util/virfirewalld.c | 6 ++----
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 22e717bce4..f6a8beec95 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -211,8 +211,7 @@ virFirewallGroupNew(void)
 {
     virFirewallGroupPtr group;
 
-    if (VIR_ALLOC(group) < 0)
-        return NULL;
+    group = g_new0(virFirewallGroup, 1);
 
     return group;
 }
@@ -235,8 +234,7 @@ virFirewallPtr virFirewallNew(void)
     if (virFirewallInitialize() < 0)
         return NULL;
 
-    if (VIR_ALLOC(firewall) < 0)
-        return NULL;
+    firewall = g_new0(virFirewall, 1);
 
     return firewall;
 }
@@ -346,8 +344,7 @@ virFirewallAddRuleFullV(virFirewallPtr firewall,
     group = firewall->groups[firewall->currentGroup];
 
 
-    if (VIR_ALLOC(rule) < 0)
-        goto no_memory;
+    rule = g_new0(virFirewallRule, 1);
 
     rule->layer = layer;
     rule->queryCB = cb;
diff --git a/src/util/virfirewalld.c b/src/util/virfirewalld.c
index a94ac7c183..3178bf4b3d 100644
--- a/src/util/virfirewalld.c
+++ b/src/util/virfirewalld.c
@@ -139,8 +139,7 @@ virFirewallDGetBackend(void)
     if (!sysbus)
         return -1;
 
-    if (VIR_ALLOC(error) < 0)
-        return -1;
+    error = g_new0(virError, 1);
 
     message = g_variant_new("(ss)",
                             "org.fedoraproject.FirewallD1.config",
@@ -289,8 +288,7 @@ virFirewallDApplyRule(virFirewallLayer layer,
         return -1;
     }
 
-    if (VIR_ALLOC(error) < 0)
-        return -1;
+    error = g_new0(virError, 1);
 
     message = g_variant_new("(s@as)",
                             ipv,
-- 
2.26.2




[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