Merge "Fix prevent issues" into tizen_2.1
authorHokwon Song <hokwon.song@samsung.com>
Fri, 5 Apr 2013 06:46:20 +0000 (15:46 +0900)
committerGerrit Code Review <gerrit2@kim11>
Fri, 5 Apr 2013 06:46:20 +0000 (15:46 +0900)
src/app/FApp_AppSettingImpl.cpp
src/io/FIo_DataRowImpl.cpp
src/io/FIo_MessagePortProxy.cpp
src/server/io/FIo_IpcServer.cpp

index 4502758..949a767 100644 (file)
@@ -948,10 +948,10 @@ _AppSettingImpl::UpdateProperty(xmlNodePtr pNode, const String& value)
 {
        const xmlChar* pPropValue = reinterpret_cast<const xmlChar*>("value");
 
-       std::unique_ptr<ByteBuffer> pBuf(Tizen::Base::Utility::StringUtil::StringToUtf8N(value));
-       if (pBuf)
+       if (value.IsEmpty())
        {
-               xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, reinterpret_cast<const xmlChar*>(pBuf->GetPointer()));
+               const xmlChar* pZeroLength = reinterpret_cast<const xmlChar*>("");
+               xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, pZeroLength);
                if (attrPtr)
                {
                        return true;
@@ -959,7 +959,19 @@ _AppSettingImpl::UpdateProperty(xmlNodePtr pNode, const String& value)
        }
        else
        {
-               SysLog(NID_APP, "StringToUtf8N is failed.");
+               std::unique_ptr<ByteBuffer> pBuf(Tizen::Base::Utility::StringUtil::StringToUtf8N(value));
+               if (pBuf)
+               {
+                       xmlAttrPtr attrPtr = xmlSetProp(pNode, pPropValue, reinterpret_cast<const xmlChar*>(pBuf->GetPointer()));
+                       if (attrPtr)
+                       {
+                               return true;
+                       }
+               }
+               else
+               {
+                       SysLog(NID_APP, "StringToUtf8N is failed.");
+               }
        }
        return false;
 }
index 97f211c..2bfaa6b 100755 (executable)
@@ -148,7 +148,7 @@ _DataRowImpl::SetDateTimeAt(int columnIndex, const Tizen::Base::DateTime& value)
        unique_ptr<_DataItem>pItem(new (std::nothrow) _DataItem());
        pDateTimeStr = _StringConverter::CopyToCharArrayN(value.ToString());
        unique_ptr<String> pString(new (std::nothrow) String(pDateTimeStr));
-       delete pDateTimeStr;
+       delete[] pDateTimeStr;
        SysTryReturnResult(NID_IO, pItem != null && pString != null, E_OUT_OF_MEMORY,
                        "The memory is insufficient.");
 
index 4cc91b7..57a7217 100644 (file)
@@ -125,7 +125,7 @@ OnMessageReceived(int id, const char* remote_app_id, const char* remote_port, bo
                SysTryCatch(NID_IO, pMap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
                result r = pMap->Construct();
-               SysTryCatch(NID_IO, r == E_SUCCESS, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+               SysTryCatch(NID_IO, r == E_SUCCESS, delete pMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
                SysLog(NID_IO, "bundle to map");
 
@@ -176,7 +176,7 @@ OnTrustedMessageReceived(int id, const char* remote_app_id, const char* remote_p
                SysTryCatch(NID_IO, pMap != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
                result r = pMap->Construct();
-               SysTryCatch(NID_IO, r == E_SUCCESS, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+               SysTryCatch(NID_IO, r == E_SUCCESS, delete pMap, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
                bundle_foreach(data, ConvertBundleToMap, pMap);
 
@@ -498,6 +498,7 @@ _MessagePortProxy::ConvertMapToBundleN(const HashMap* pMap)
                                {
                                        SysLog(NID_IO, "Not supported");
 
+                                       bundle_free(b);
                                        return null;
                                }
                        }
@@ -506,6 +507,7 @@ _MessagePortProxy::ConvertMapToBundleN(const HashMap* pMap)
                {
                        SysLog(NID_IO, "Not supported");
 
+                       bundle_free(b);
                        return null;
                }
        }
index 24a0d53..f6f9f83 100644 (file)
@@ -217,7 +217,9 @@ _IpcServer::Construct(const String& name, const _IIpcServerEventListener& listen
        SysTryCatch(NID_IO, ret == 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to change permission of a socket(%d, %s): %s", serverSocket,
                           socketName.c_str(), strerror(errno));
 
-       listen(serverSocket, 15);
+       ret = listen(serverSocket, 15);
+       SysTryCatch(NID_IO, ret == 0, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Failed to listen the socket(%d, %s): %s", serverSocket,
+                          socketName.c_str(), strerror(errno));
 
        pGIOChannel = g_io_channel_unix_new(serverSocket);
        SysTryCatch(NID_IO, pGIOChannel != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");