fix: add null-check before buf_ allocation in ProcessQueryImpl#2165
fix: add null-check before buf_ allocation in ProcessQueryImpl#2165mukejane wants to merge 1 commit into
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Require kind labelWonderful, this rule succeeded.
🟢 Require version labelWonderful, this rule succeeded.
🟢 Require linked issue for feature/bug PRsWonderful, this rule succeeded.
|
There was a problem hiding this comment.
Code Review
This pull request updates ProcessQueryImpl in transform_quantizer.h to only allocate memory for computer.inner_computer_->buf_ if it is currently null, avoiding unnecessary allocations. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Fixes antgroup#2163. Prevents memory leak when SetQuery() is called multiple times on the same Computer object. Matches the pattern used in ScalarQuantizer. Signed-off-by: mukejane <mukejane@outlook.com>
52115bc to
660757b
Compare
|
Hi @antgroup/vsag — this PR fixes a null pointer bug in |
|
Hi @mukejane, thanks for your contribution! I added labels and triggered the CI Testing. Now, please wait for the testing. |
Fixes #2163
Root cause:
ProcessQueryImplunconditionally allocatescomputer.inner_computer_->buf_without checking if it is already non-null. IfSetQuery()is called more than once on the sameComputerobject, the previously allocated buffer is leaked.Fix: Wrap the allocation in a null-check, matching the pattern already used in
ScalarQuantizer:Also applies to the
bad_alloccatch block —buf_is now only set tonullptrwhen it was originally null, avoiding overwriting an existing allocation on rethrow.