Fix svace issue for 118 checkers 42/115342/1 accepted/tizen/3.0/common/20170220.130551 accepted/tizen/3.0/mobile/20170220.064722 accepted/tizen/3.0/wearable/20170220.064740 submit/tizen_3.0/20170220.034427
authorjh8801.jung <jh8801.jung@samsung.com>
Fri, 17 Feb 2017 10:59:02 +0000 (19:59 +0900)
committerjh8801.jung <jh8801.jung@samsung.com>
Fri, 17 Feb 2017 10:59:34 +0000 (19:59 +0900)
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
Change-Id: I7ae7337a60964a03e448008c6ff7c8c98d6cd461

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

index c5d34c1..a83b598 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 c8baaa8..7676943 100644 (file)
@@ -1,6 +1,6 @@
 Name:       nfc-plugin-emul
 Summary:    NFC emul plugin
-Version:    0.0.20
+Version:    0.0.21
 Release:    0
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
index e7a223e..c636b14 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)
        {
@@ -2201,6 +2208,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 +2281,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 +2292,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 +2301,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 +2312,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();