[PATCH 2/2] Fix "__warn_memset_zero_len"

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

 



---
 tools/osinfo-query.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
index 8c96b62..69b789a 100644
--- a/tools/osinfo-query.c
+++ b/tools/osinfo-query.c
@@ -251,9 +251,11 @@ static gboolean print_entity_text(OsinfoEntity *entity,
             pad = labels[i].width - (val ? strlen(val) : 0);
 
         padstr = g_new0(gchar, pad+1);
-        memset(padstr, ' ', pad);
         padstr[pad] = '\0';
 
+        if (pad)
+            memset(padstr, ' ', pad);
+
         g_print("%s%s",
                 val ? val : "", padstr);
         g_free(padstr);
@@ -295,9 +297,11 @@ static gboolean print_results_text(OsinfoList *list,
             pad = labels[i].width - strlen(labels[i].label);
 
         padstr = g_new0(gchar, pad+1);
-        memset(padstr, ' ', pad);
         padstr[pad] = '\0';
 
+        if (pad)
+            memset(padstr, ' ', pad);
+
         g_print("%s%s",
                 labels[i].label, padstr);
         g_free(padstr);
-- 
1.7.9.3


[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux