Fix a fd mis-match
[platform/framework/native/appfw.git] / src / io / FIo_IpcClient.cpp
index 62a5957..6e1061f 100644 (file)
@@ -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;
                }
        }