From: VMware, Inc <> Date: Wed, 18 Sep 2013 03:32:13 +0000 (-0700) Subject: Add 4 new guestRPC commands for namespace manager. X-Git-Tag: 2013.09.16-1328054~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4f7f191d0cb1d260f1b13e2545340109be4631d;p=thirdparty%2Fopen-vm-tools.git Add 4 new guestRPC commands for namespace manager. Signed-off-by: Dmitry Torokhov --- diff --git a/open-vm-tools/lib/rpcChannel/vsockChannel.c b/open-vm-tools/lib/rpcChannel/vsockChannel.c index f12a81deb..0c5cf37d2 100644 --- a/open-vm-tools/lib/rpcChannel/vsockChannel.c +++ b/open-vm-tools/lib/rpcChannel/vsockChannel.c @@ -415,6 +415,9 @@ VSockChannelShutdown(RpcChannel *chan) // IN * VSockChannelSend -- * * Sends the data using the vsocket channel. + * If the caller is not interested in the reply, result and resultLen + * can be set to NULL, otherwise, the caller *must* free the result + * whether the call is successful or not to avoid memory leak. * * Result: * TRUE on success @@ -430,24 +433,24 @@ static gboolean VSockChannelSend(RpcChannel *chan, // IN char const *data, // IN size_t dataLen, // IN - char **result, // OUT - size_t *resultLen) // OUT + char **result, // OUT optional + size_t *resultLen) // OUT optional { gboolean ret = FALSE; VSockChannel *vsock = chan->_private; - const char *reply; - size_t replyLen; + const char *reply = NULL; + size_t replyLen = 0; if (!chan->outStarted) { goto exit; } + /* + * We propagate all replies from VSockOutSend: either a reply of the RPC + * result or a description of the error on failure. + */ ret = VSockOutSend(vsock->out, data, dataLen, &reply, &replyLen); - if (!ret) { - goto exit; - } - if (result != NULL) { if (reply != NULL) { *result = Util_SafeMalloc(replyLen + 1);