fix: [3.3.6] memory leak and use-after-free crash#35142
fix: [3.3.6] memory leak and use-after-free crash#35142guanshengliang merged 2 commits into3.3.6from
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses memory-lifecycle issues (leaks / potential use-after-free) in client async DDL execution and executor sys-table scan flows, and tweaks CI upgrade compatibility download caching.
Changes:
- Executor: free and clear
pInfo->pRspinsysTableScanFromMNode()to avoid stale pointers after freeing response buffers. - Client: free
pQuery->pCmdMsgimmediately afterasyncSendMsgToServer()inasyncExecDdlQuery()to prevent orphaned allocations during shutdown/atexit teardown. - CI: lower cached “valid file” size threshold from 30M to 10M for upgrade compatibility artifact reuse.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/ci/run_upgrade_compat.sh | Adjusts local cache validation threshold for downloaded “green versions”. |
| source/libs/executor/src/sysscanoperator.c | Clears pInfo->pRsp when freeing response to avoid dangling pointers. |
| source/client/src/clientImpl.c | Frees pQuery->pCmdMsg earlier in async DDL path to prevent leaks during teardown. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces memory management improvements by explicitly freeing pQuery->pCmdMsg in the client implementation and adopting taosMemoryFreeClear for response buffers in the system scan operator. It also reduces the cache validation size threshold in the CI upgrade script. Feedback indicates that the script's cache validation heuristic is fragile and recommends using a more robust method like checksums or manifest files to ensure environment consistency.
… use-after-free(sync from main repair)
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.