提交 e9538813 编写于 作者: M Marc Hartmayer 提交者: John Ferlan

rpc: first allocate the memory and then set the count

Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: NBjoern Walk <bwalk@linux.vnet.ibm.com>
上级 ebe81395
......@@ -296,9 +296,9 @@ int virNetClientProgramCall(virNetClientProgramPtr prog,
msg->header.type = noutfds ? VIR_NET_CALL_WITH_FDS : VIR_NET_CALL;
msg->header.serial = serial;
msg->header.proc = proc;
msg->nfds = noutfds;
if (VIR_ALLOC_N(msg->fds, msg->nfds) < 0)
if (VIR_ALLOC_N(msg->fds, noutfds) < 0)
goto error;
msg->nfds = noutfds;
for (i = 0; i < msg->nfds; i++)
msg->fds[i] = -1;
for (i = 0; i < msg->nfds; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册