Fix alloc free mismatch coverty issue in bt-otp 65/224865/2
authorSudipto <sudipto.bal@samsung.com>
Thu, 13 Feb 2020 13:22:35 +0000 (18:52 +0530)
committerSudipto <sudipto.bal@samsung.com>
Fri, 14 Feb 2020 07:45:48 +0000 (13:15 +0530)
Change-Id: If2eaa7e71fa044712a4fdc6b1dc0b5499a612c37
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
bt-otp/bt-otpserver.c

index c588be9..23a2b9f 100644 (file)
@@ -1188,8 +1188,6 @@ void _bt_otp_create_new_object(uint32_t size, char *uuid)
        curr_obj_index = g_slist_length(otp_object_list) - 1;
        curr_obj_id = selected_object->id;
        object_id++;
-
-       free(uuid);
 }
 
 void _bt_otp_restore_old_object()
@@ -1224,7 +1222,7 @@ int _bt_otp_oacp_write_cb(char *value, int len, int offset,
        int opcode = value[0];
        uint32_t object_offset, length, object_size;
        uint8_t mode = 0;
-       char *uuid;
+       char *uuid = NULL;
        char absolute_file_path[BT_FILE_PATH_MAX_LEN] = {0, };
 
        BT_INFO("OACP Opcode 0x%d", opcode);
@@ -1258,6 +1256,7 @@ int _bt_otp_oacp_write_cb(char *value, int len, int offset,
 
                oacp_create = TRUE;
                _bt_otp_create_new_object(object_size, uuid);
+               g_free(uuid);
 
                if (oacp_create_timeout_id > 0)
                        g_source_remove(oacp_create_timeout_id);