mirror of
https://github.com/fanlumaster/googlepinyinime-rev.git
synced 2026-10-10 04:53:13 +08:00
fix(decoder): 释放词典索引与同步缓冲区并加入泄漏检测
This commit is contained in:
@@ -33,3 +33,23 @@ jobs:
|
||||
run: cmake --build build --config Release --parallel 4
|
||||
- name: Run regression tests
|
||||
run: ctest --test-dir build -C Release --output-on-failure --no-tests=error --timeout 30
|
||||
sanitizers:
|
||||
name: Linux ASan and UBSan
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Configure
|
||||
run: >-
|
||||
cmake -S tests -B build-sanitizers -DCMAKE_BUILD_TYPE=Debug
|
||||
-DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer"
|
||||
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
|
||||
- name: Build
|
||||
run: cmake --build build-sanitizers --parallel 4
|
||||
- name: Run regression tests
|
||||
env:
|
||||
ASAN_OPTIONS: detect_leaks=1:halt_on_error=1
|
||||
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1
|
||||
run: ctest --test-dir build-sanitizers --output-on-failure --no-tests=error --timeout 30
|
||||
|
||||
@@ -56,8 +56,8 @@ void DictTrie::free_resource(bool free_dict_list) {
|
||||
if (NULL != nodes_ge1_) free(nodes_ge1_);
|
||||
nodes_ge1_ = NULL;
|
||||
|
||||
if (NULL != nodes_ge1_) free(nodes_ge1_);
|
||||
nodes_ge1_ = NULL;
|
||||
if (NULL != lma_idx_buf_) free(lma_idx_buf_);
|
||||
lma_idx_buf_ = NULL;
|
||||
|
||||
if (free_dict_list) {
|
||||
if (NULL != dict_list_) {
|
||||
|
||||
@@ -336,6 +336,9 @@ out:
|
||||
free(offsets_by_id_);
|
||||
free(scores_);
|
||||
free(ids_);
|
||||
#ifdef ___SYNC_ENABLED___
|
||||
free(syncs_);
|
||||
#endif
|
||||
#ifdef ___PREDICT_ENABLED___
|
||||
free(predicts_);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user