)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b2ec391210fb58299cd889469e3449b9b0c50f53","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"3d73c955_ae8c7b29","updated":"2023-03-22 17:40:02.000000000","message":"I\u0027m not familiar with the FreeRTOS code, but I think this change is not correct.","commit_id":"27ffaeb6ade6be30f796c5201ea76731d29a07f8"}],"src/rtos/FreeRTOS.c":[{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b2ec391210fb58299cd889469e3449b9b0c50f53","unresolved":true,"context_lines":[{"line_number":312,"context_line":"\t\t\t\t(list_elem_ptr !\u003d prev_list_elem_ptr) \u0026\u0026"},{"line_number":313,"context_line":"\t\t\t\t(tasks_found \u003c thread_list_size)) {"},{"line_number":314,"context_line":"\t\t\t/* Get the location of the thread structure. */"},{"line_number":315,"context_line":"\t\t\trtos-\u003ethread_details[tasks_found].threadid \u003d 0;"},{"line_number":316,"context_line":"\t\t\tretval \u003d target_read_u32(rtos-\u003etarget,"},{"line_number":317,"context_line":"\t\t\t\t\tlist_elem_ptr + param-\u003elist_elem_content_offset,"},{"line_number":318,"context_line":"\t\t\t\t\t\u0026pointer_casts_are_bad);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"252e2d63_f4a3daa4","side":"PARENT","line":315,"updated":"2023-03-22 17:40:02.000000000","message":"If the call to target_read_u32() in next line fails, then this function returns.\nIn such case, tasks_found is already incremented, but threadid is an uninitialized value.\nI think this initialization to zero is needed.","commit_id":"b6b4f9d46a48aadc1de6bb5152ff4913661c9059"},{"author":{"_account_id":1002124,"name":"Chao Du","email":"89669443@qq.com","username":"Du-Chao"},"change_message_id":"1744097fe35f92423b21e05bddb31c3660b21025","unresolved":false,"context_lines":[{"line_number":312,"context_line":"\t\t\t\t(list_elem_ptr !\u003d prev_list_elem_ptr) \u0026\u0026"},{"line_number":313,"context_line":"\t\t\t\t(tasks_found \u003c thread_list_size)) {"},{"line_number":314,"context_line":"\t\t\t/* Get the location of the thread structure. */"},{"line_number":315,"context_line":"\t\t\trtos-\u003ethread_details[tasks_found].threadid \u003d 0;"},{"line_number":316,"context_line":"\t\t\tretval \u003d target_read_u32(rtos-\u003etarget,"},{"line_number":317,"context_line":"\t\t\t\t\tlist_elem_ptr + param-\u003elist_elem_content_offset,"},{"line_number":318,"context_line":"\t\t\t\t\t\u0026pointer_casts_are_bad);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"7cc90ff7_cb7ecb36","side":"PARENT","line":315,"in_reply_to":"08ab7f76_6cfba5ee","updated":"2023-03-29 06:54:18.000000000","message":"Thanks and you are right.\nI amended a new patch which may avoid the risk of memory leak.\nPlease review and comment.","commit_id":"b6b4f9d46a48aadc1de6bb5152ff4913661c9059"},{"author":{"_account_id":1002124,"name":"Chao Du","email":"89669443@qq.com","username":"Du-Chao"},"change_message_id":"79a51c0ac4536c32ea89e7d7a46aedfa3154ab0c","unresolved":true,"context_lines":[{"line_number":312,"context_line":"\t\t\t\t(list_elem_ptr !\u003d prev_list_elem_ptr) \u0026\u0026"},{"line_number":313,"context_line":"\t\t\t\t(tasks_found \u003c thread_list_size)) {"},{"line_number":314,"context_line":"\t\t\t/* Get the location of the thread structure. */"},{"line_number":315,"context_line":"\t\t\trtos-\u003ethread_details[tasks_found].threadid \u003d 0;"},{"line_number":316,"context_line":"\t\t\tretval \u003d target_read_u32(rtos-\u003etarget,"},{"line_number":317,"context_line":"\t\t\t\t\tlist_elem_ptr + param-\u003elist_elem_content_offset,"},{"line_number":318,"context_line":"\t\t\t\t\t\u0026pointer_casts_are_bad);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"cdf74cb3_c084de19","side":"PARENT","line":315,"in_reply_to":"252e2d63_f4a3daa4","updated":"2023-03-23 01:55:29.000000000","message":"Thanks for the comment. I would make some clarification here:\n\nThe only place where the rtos-\u003ethread_details[] are used is in gdb_generate_thread_list(). The list size is controlled by rtos-\u003ethread_count.\n\nIf any exception happens in this freertos_update_threads() function, as you mentioned, the rtos-\u003ethread_count will not be updated. So the thread_details[tasks_found] will not be included in gdb_generate_thread_list().","commit_id":"b6b4f9d46a48aadc1de6bb5152ff4913661c9059"},{"author":{"_account_id":1000687,"name":"Tomas Vanek","display_name":"Tomas Vanek","email":"vanekt@fbl.cz","username":"vanekt"},"change_message_id":"7d2e434124ee1a3227d139fb8eb6fb06717ce012","unresolved":false,"context_lines":[{"line_number":312,"context_line":"\t\t\t\t(list_elem_ptr !\u003d prev_list_elem_ptr) \u0026\u0026"},{"line_number":313,"context_line":"\t\t\t\t(tasks_found \u003c thread_list_size)) {"},{"line_number":314,"context_line":"\t\t\t/* Get the location of the thread structure. */"},{"line_number":315,"context_line":"\t\t\trtos-\u003ethread_details[tasks_found].threadid \u003d 0;"},{"line_number":316,"context_line":"\t\t\tretval \u003d target_read_u32(rtos-\u003etarget,"},{"line_number":317,"context_line":"\t\t\t\t\tlist_elem_ptr + param-\u003elist_elem_content_offset,"},{"line_number":318,"context_line":"\t\t\t\t\t\u0026pointer_casts_are_bad);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"08ab7f76_6cfba5ee","side":"PARENT","line":315,"in_reply_to":"a83d1d40_a4d1ce60","updated":"2023-03-28 09:32:07.000000000","message":"\u003e If any exception happens in this freertos_update_threads() function, as you\n\u003e mentioned, the rtos-\u003ethread_count will not be updated.\n\nYes, this analysis seems me correct. The question is if such negligible change is worth to deal with.\n\nBTW: If an exception happens in the thread which is not the first one, rtos-\u003ethread_count will stay at 0 and the allocated thread_name_str and extra_info_str of previous threads will leak, because rtos_free_threadlist() will not free them.","commit_id":"b6b4f9d46a48aadc1de6bb5152ff4913661c9059"},{"author":{"_account_id":1000021,"name":"Antonio Borneo","email":"borneo.antonio@gmail.com","username":"borneoa"},"change_message_id":"b3e60eae3f487fe2f111bd40b866b6bf5829932a","unresolved":false,"context_lines":[{"line_number":312,"context_line":"\t\t\t\t(list_elem_ptr !\u003d prev_list_elem_ptr) \u0026\u0026"},{"line_number":313,"context_line":"\t\t\t\t(tasks_found \u003c thread_list_size)) {"},{"line_number":314,"context_line":"\t\t\t/* Get the location of the thread structure. */"},{"line_number":315,"context_line":"\t\t\trtos-\u003ethread_details[tasks_found].threadid \u003d 0;"},{"line_number":316,"context_line":"\t\t\tretval \u003d target_read_u32(rtos-\u003etarget,"},{"line_number":317,"context_line":"\t\t\t\t\tlist_elem_ptr + param-\u003elist_elem_content_offset,"},{"line_number":318,"context_line":"\t\t\t\t\t\u0026pointer_casts_are_bad);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"a83d1d40_a4d1ce60","side":"PARENT","line":315,"in_reply_to":"cdf74cb3_c084de19","updated":"2023-03-23 08:36:27.000000000","message":"Ack\nYou are right! rtos-\u003ethread_count is only updated when the function exits successfully.\nThanks!","commit_id":"b6b4f9d46a48aadc1de6bb5152ff4913661c9059"}]}
