Sync with 3.0 : Ver. 0.0.20 to 0.0.23 11/121911/2
authorjh8801.jung <jh8801.jung@samsung.com>
Wed, 29 Mar 2017 10:13:22 +0000 (19:13 +0900)
committerjh8801.jung <jh8801.jung@samsung.com>
Wed, 29 Mar 2017 11:07:34 +0000 (20:07 +0900)
Change-Id: I051e6bf90b32357be0c08b8953782347dc477dea

CMakeLists.txt
packaging/nfc-plugin-emul.spec
src/oem/oem_emul.c

index c5d34c1a2aa74c9e3c589523401016a0574822fa..a83b598522ec3978d676f8276cb69828a299215e 100755 (executable)
@@ -38,5 +38,3 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} pthread "-ldl")
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib/nfc)
-
-
index c8baaa81282f561ac3dd965088f3763d7d4d428a..531e400882490855628ff676085526e02bd4b819 100644 (file)
@@ -1,6 +1,6 @@
 Name:       nfc-plugin-emul
 Summary:    NFC emul plugin
-Version:    0.0.20
+Version:    0.0.23
 Release:    0
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
@@ -32,8 +32,6 @@ make %{?jobs:-j%jobs}
 rm -rf %{buildroot}
 %make_install
 
-install -D -m 0644 LICENSE.Apache-2.0  %{buildroot}/%{_datadir}/license/nfc-plugin-emul
-
 mkdir -p %{buildroot}/usr/lib/udev/rules.d
 cp 98-nfc-plugin-emul.rules %{buildroot}/usr/lib/udev/rules.d/98-nfc-plugin-emul.rules
 
@@ -42,7 +40,7 @@ cp 98-nfc-plugin-emul.rules %{buildroot}/usr/lib/udev/rules.d/98-nfc-plugin-emul
 %post -p /sbin/ldconfig
 
 %files
+%license LICENSE.Apache-2.0
 %defattr(-,root,root,-)
 /usr/lib/nfc/libnfc-plugin.so
-%{_datadir}/license/nfc-plugin-emul
 /usr/lib/udev/rules.d/98-nfc-plugin-emul.rules
index e7a223e67ee50ec6b8414034ce7e773bb9b36a5d..c4890b0131a61d1d7c22ea624989c654b5a8b894 100755 (executable)
@@ -1140,6 +1140,8 @@ static bool _net_nfc_create_ndef_from_emulMsg(emulMsg_s *emul_msg)
 
        _net_nfc_store_ndef_message(&rawdata);
 
+       _nfc_emul_util_free_mem(rawdata.buffer);
+
        DEBUG_EMUL_END();
 
        return retval;
@@ -1257,9 +1259,11 @@ static void _net_nfc_destroy_emulMsg(emulMsg_s *emul_msg)
 {
        DEBUG_EMUL_BEGIN();
 
-       if(emul_msg != NULL && emul_msg->file_data != NULL)
+       if(emul_msg != NULL)
        {
-               free(emul_msg->file_data);
+               if(emul_msg->file_data != NULL)
+                       free(emul_msg->file_data);
+
                free(emul_msg);
        }
 
@@ -1485,6 +1489,8 @@ static void _net_nfc_llcp_create_snep_server_msg(snep_command_field_e resp_field
        if(rawdata.length > 0)
                memcpy(temp, rawdata.buffer, rawdata.length);
 
+       _nfc_emul_util_free_mem(rawdata.buffer);
+
        DEBUG_EMUL_END();
 }
 
@@ -1506,6 +1512,7 @@ static bool _net_nfc_make_llcp_data(emulMsg_s *emul_msg)
        data_s rawdata = { NULL, 0 };
 
        _net_nfc_retrieve_ndef_message(&rawdata);
+       _nfc_emul_util_free_mem(rawdata.buffer);
 
        if (emul_msg->record_count == 0 || rawdata.length == 0)
        {
@@ -1688,12 +1695,6 @@ static void emul_ReaderThread(void * pArg)
 
                DEBUG_MSG("epoll wait >>>>");
 
-               if(emulMsg_poll_fd == -1 || emulMsg_file_fd == -1)
-               {
-                       DEBUG_MSG("client is deinitialized. ");
-                       condition = 0;
-               }
-
                while((num_of_files = epoll_wait(emulMsg_poll_fd, emulMsg_poll_events, EPOLL_SIZE, -1)) == 0) {
                        DEBUG_MSG("no data is changed ");
                }
@@ -2201,6 +2202,7 @@ static bool net_nfc_emul_controller_check_ndef(net_nfc_target_handle_s* handle,
        DEBUG_EMUL_BEGIN();
 
        _net_nfc_retrieve_ndef_message(&rawdata);
+       _nfc_emul_util_free_mem(rawdata.buffer);
 
        if (_net_nfc_emul_get_is_tag_attached())
        {
@@ -2273,7 +2275,10 @@ static bool net_nfc_emul_controller_read_ndef(net_nfc_target_handle_s* handle, d
 
        *result = _net_nfc_retrieve_ndef_message(&rawdata);
        if(*result != NET_NFC_OK)
+       {
+               _nfc_emul_util_free_mem(rawdata.buffer);
                return false;
+       }
 
        real_data_size = rawdata.length;
 
@@ -2281,6 +2286,7 @@ static bool net_nfc_emul_controller_read_ndef(net_nfc_target_handle_s* handle, d
        {
                DEBUG_ERR_MSG("read ndef_msg is failed >>> real_data_size is zero");
                *result = NET_NFC_NO_NDEF_MESSAGE;
+               _nfc_emul_util_free_mem(rawdata.buffer);
                return false;
        }
 
@@ -2289,6 +2295,7 @@ static bool net_nfc_emul_controller_read_ndef(net_nfc_target_handle_s* handle, d
        if(*data == NULL)
        {
                *result = NET_NFC_ALLOC_FAIL;
+               _nfc_emul_util_free_mem(rawdata.buffer);
                return false;
        }
 
@@ -2299,11 +2306,13 @@ static bool net_nfc_emul_controller_read_ndef(net_nfc_target_handle_s* handle, d
        {
                free(*data);
                *result = NET_NFC_ALLOC_FAIL;
+               _nfc_emul_util_free_mem(rawdata.buffer);
                return false;
        }
 
        /* copy rawdata to data->buffer */
        memcpy((*data)->buffer, rawdata.buffer, real_data_size);
+       _nfc_emul_util_free_mem(rawdata.buffer);
 
        DEBUG_EMUL_END();