mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 16:15:19 +00:00
rpc: first allocate the memory and then set the count
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
This commit is contained in:
parent
ebe8139536
commit
e9538813ec
@ -296,9 +296,9 @@ int virNetClientProgramCall(virNetClientProgramPtr prog,
|
|||||||
msg->header.type = noutfds ? VIR_NET_CALL_WITH_FDS : VIR_NET_CALL;
|
msg->header.type = noutfds ? VIR_NET_CALL_WITH_FDS : VIR_NET_CALL;
|
||||||
msg->header.serial = serial;
|
msg->header.serial = serial;
|
||||||
msg->header.proc = proc;
|
msg->header.proc = proc;
|
||||||
msg->nfds = noutfds;
|
if (VIR_ALLOC_N(msg->fds, noutfds) < 0)
|
||||||
if (VIR_ALLOC_N(msg->fds, msg->nfds) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
msg->nfds = noutfds;
|
||||||
for (i = 0; i < msg->nfds; i++)
|
for (i = 0; i < msg->nfds; i++)
|
||||||
msg->fds[i] = -1;
|
msg->fds[i] = -1;
|
||||||
for (i = 0; i < msg->nfds; i++) {
|
for (i = 0; i < msg->nfds; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user