Projects
openEuler:C
gazelle
_service:tar_scm:0128-fix-t_params-double-free....
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0128-fix-t_params-double-free.patch of Package gazelle
From 8905d508d754a6d75516bbf26839848f4dfef282 Mon Sep 17 00:00:00 2001 From: jiangheng <jiangheng14@huawei.com> Date: Mon, 29 Jan 2024 19:11:45 +0800 Subject: [PATCH] fix t_params double free --- src/lstack/core/lstack_protocol_stack.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lstack/core/lstack_protocol_stack.c b/src/lstack/core/lstack_protocol_stack.c index 800872b..bb7ec17 100644 --- a/src/lstack/core/lstack_protocol_stack.c +++ b/src/lstack/core/lstack_protocol_stack.c @@ -660,7 +660,7 @@ int32_t stack_setup_thread(void) for (uint32_t i = 0; i < queue_num; ++i) { t_params[i] = malloc(sizeof(struct thread_params)); if (t_params[i] == NULL) { - goto OUT; + goto OUT1; } } @@ -669,18 +669,18 @@ int32_t stack_setup_thread(void) if (i % 2 == 0) { ret = sprintf_s(name, sizeof(name), "%s_%d_%d", LSTACK_RECV_THREAD_NAME, process_index, i / 2); if (ret < 0) { - goto OUT; + goto OUT1; } } else { ret = sprintf_s(name, sizeof(name), "%s_%d_%d", LSTACK_SEND_THREAD_NAME, process_index, i / 2); if (ret < 0) { - goto OUT; + goto OUT1; } } } else { ret = sprintf_s(name, sizeof(name), "%s", LSTACK_THREAD_NAME); if (ret < 0) { - goto OUT; + goto OUT1; } } @@ -689,24 +689,26 @@ int32_t stack_setup_thread(void) ret = create_thread((void *)t_params[i], name, gazelle_stack_thread); if (ret != 0) { - goto OUT; + goto OUT1; } } /* 2: wait stack thread and kernel_event thread init finish */ wait_sem_value(&g_stack_group.sem_stack_setup, queue_num * 2); if (g_stack_group.stack_setup_fail) { - goto OUT; + /* t_params free by stack thread */ + goto OUT2; } g_stack_group.stack_num = queue_num; return 0; -OUT: +OUT1: for (int32_t i = 0; i < queue_num; ++i) { if (t_params[i] != NULL) { free(t_params[i]); } } +OUT2: return -1; } -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.