[PATCH 2/2] virstring: Use 'g_new0' instead of improper use of 'g_malloc0_n'

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virstring.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/util/virstring.c b/src/util/virstring.c
index bc9b6cd40e..15c3f7bdd1 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -1078,12 +1078,10 @@ void
 virStringListRemoveDuplicates(char ***list)
 {
     size_t len = g_strv_length(*list);
-    char **unique;
+    char **unique = g_new0(char *, len + 1);
     size_t n = 0;
     size_t i;

-    unique = g_malloc0_n(len + 1, sizeof(char *));
-
     for (i = 0; i < len; i++) {
         if (n > 0 && STREQ_NULLABLE(unique[n - 1], (*list)[i]))
             g_free((*list)[i]);
-- 
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