[PATCH 08/13] securityselinuxhelper: Use g_new0() instead of malloc()+memset() combo

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

 



Inside of securityselinuxhelper we still use malloc() +
memset(.., 0, ...) combo. Convert it to g_new0().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/securityselinuxhelper.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/securityselinuxhelper.c b/tests/securityselinuxhelper.c
index c32c90c17e..797f090a7e 100644
--- a/tests/securityselinuxhelper.c
+++ b/tests/securityselinuxhelper.c
@@ -173,9 +173,8 @@ int getfilecon_raw(const char *path, char **con)
     }
     if (len < 0)
         return -1;
-    if (!(constr = malloc(len+1)))
-        return -1;
-    memset(constr, 0, len);
+
+    constr = g_new0(char, len + 1);
     if (getxattr(path, "user.libvirt.selinux", constr, len) < 0) {
         free(constr);
         return -1;
-- 
2.41.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