Fix error codes 80/175180/1
authorInkyun Kil <inkyun.kil@samsung.com>
Mon, 9 Apr 2018 07:37:11 +0000 (16:37 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Mon, 9 Apr 2018 07:37:11 +0000 (16:37 +0900)
Change-Id: I3f961813c36880e95cbfcf4349290a59e99c52de
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
include/rpc-port-parcel.h
src/rpc-port-parcel.cc

index 04e9a23..715d020 100644 (file)
@@ -68,7 +68,7 @@ int rpc_port_parcel_create(rpc_port_parcel_h *h);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #RPC_PORT_ERROR_NONE Successful
- * @retval #RPC_PORT_ERROR_INVALID_PARAMETER The specified @a h is NULL
+ * @retval #RPC_PORT_ERROR_INVALID_PARAMETER The specified @a port is NULL
  * @retval #RPC_PORT_ERROR_IO_ERROR Internal I/O error
  * @see rpc_port_parcel_destroy()
  * @see rpc_port_parcel_send()
index 1a266d8..5ede077 100755 (executable)
@@ -41,6 +41,9 @@ RPC_API int rpc_port_parcel_create_from_port(rpc_port_parcel_h* h,
   int len;
   unsigned char* buf;
 
+  if (port == nullptr)
+    return RPC_PORT_ERROR_INVALID_PARAMETER;
+
   internal::Port* pt = static_cast<internal::Port*>(port);
   {
     std::lock_guard<std::recursive_mutex> lock(pt->GetMutex());
@@ -67,6 +70,9 @@ RPC_API int rpc_port_parcel_create_from_port(rpc_port_parcel_h* h,
 }
 
 RPC_API int rpc_port_parcel_send(rpc_port_parcel_h h, rpc_port_h port) {
+  if (h == nullptr || port == nullptr)
+    return RPC_PORT_ERROR_INVALID_PARAMETER;
+
   Parcel* p = static_cast<Parcel*>(h);
   int len = p->GetRaw().size();