From f4dda3073c85bb497e9887497d1098172faea602 Mon Sep 17 00:00:00 2001 From: Sunwook Bae Date: Wed, 22 May 2013 15:51:31 +0900 Subject: [PATCH] Fix a fd mis-match Change-Id: If850beafe5eb11c5da12fe9d239b44783eafd465 Signed-off-by: Sunwook Bae --- src/io/FIo_IpcClient.cpp | 11 ++++++++++- src/server/io/FIo_IpcServer.cpp | 4 ---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/io/FIo_IpcClient.cpp b/src/io/FIo_IpcClient.cpp index 62a5957..6e1061f 100644 --- a/src/io/FIo_IpcClient.cpp +++ b/src/io/FIo_IpcClient.cpp @@ -573,6 +573,8 @@ _IpcClient::SendSync(IPC::Message* pMessage) } SysLogException(NID_IO, E_SYSTEM, "[E_SYSTEM] Failed to poll (%d, %s).", errno, strerror(errno)); + + ReleaseFd(fd); return E_SYSTEM; } @@ -598,7 +600,14 @@ _IpcClient::SendSync(IPC::Message* pMessage) if (pEndOfMessage) { pReply = new (std::nothrow) IPC::Message(message.data(), pEndOfMessage - message.data()); - SysTryReturnResult(NID_IO, pReply != null, E_OUT_OF_MEMORY, "The memory is insufficient."); + if (pReply == null) + { + SysLogException(NID_IO, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + + ReleaseFd(fd); + return E_OUT_OF_MEMORY; + } + break; } } diff --git a/src/server/io/FIo_IpcServer.cpp b/src/server/io/FIo_IpcServer.cpp index a55ce49..eff2eae 100644 --- a/src/server/io/FIo_IpcServer.cpp +++ b/src/server/io/FIo_IpcServer.cpp @@ -730,8 +730,6 @@ _IpcServer::SendResponse(int client, IPC::Message* pMessage) SysTryCatch(NID_IO, ret != G_IO_STATUS_ERROR, , E_SYSTEM, "[E_SYSTEM] Error occurred during writing message to socket."); } - SysTryCatch(NID_IO, pGError == null, , E_SYSTEM, "[E_SYSTEM] Error occurred during writing message to socket."); - remain -= written; pData += written; } @@ -779,8 +777,6 @@ _IpcServer::SendResponse(int client, const IPC::Message& message) SysTryCatch(NID_IO, ret != G_IO_STATUS_ERROR, , E_SYSTEM, "[E_SYSTEM] Error occurred during writing message to socket."); } - SysTryCatch(NID_IO, pGError == null, , E_SYSTEM, "[E_SYSTEM] Error occurred during writing message to socket."); - remain -= written; pData += written; } -- 2.7.4