qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc


From: Greg Kurz
Subject: [Qemu-devel] [PATCH for 4.0 1/2] 9p: use g_new(T, n) instead of g_malloc(sizeof(T) * n)
Date: Thu, 29 Nov 2018 16:47:12 +0100
User-agent: StGit/unknown-version

Because it is a recommended coding practice (see HACKING).

Signed-off-by: Greg Kurz <address@hidden>
---
 hw/9pfs/9p.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index bdf7919abfc5..55821343e594 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1331,8 +1331,8 @@ static void coroutine_fn v9fs_walk(void *opaque)
     trace_v9fs_walk(pdu->tag, pdu->id, fid, newfid, nwnames);
 
     if (nwnames && nwnames <= P9_MAXWELEM) {
-        wnames = g_malloc0(sizeof(wnames[0]) * nwnames);
-        qids   = g_malloc0(sizeof(qids[0]) * nwnames);
+        wnames = g_new0(V9fsString, nwnames);
+        qids   = g_new0(V9fsQID, nwnames);
         for (i = 0; i < nwnames; i++) {
             err = pdu_unmarshal(pdu, offset, "s", &wnames[i]);
             if (err < 0) {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]