Repository navigation
Fix double free after comps_objmrtree_copy_shallow() - #167
Merged
m-blaha merged 1 commit intoOct 27, 2026
Conversation
m-blaha
reviewed
Oct 27, 2026
| NULL); | ||
| new_data_list = ((COMPS_ObjMRTreeData*)it->data)->data; | ||
| new_data_list = (COMPS_ObjList*) | ||
| COMPS_OBJECT_COPY(((COMPS_ObjMRTreeData*)it->data)->data); |
Member
There was a problem hiding this comment.
But this COMPS_OBJECT_COPY will do a deep copy, contradicting the function "*_copy_shallow" name.
Shouldn't we use the COMPS_OBJECT_INCREF as in similar ObjRTree code?
libcomps/libcomps/src/comps_objradix.c
Lines 226 to 229 in 326114b
comps_objmrtree_copy_shallow() put the value lists of all nodes below the first level into the copy without taking a reference, so destroying the copy freed lists still used by the original. MDict.copy() followed by deleting the copy crashed. Take a reference to the lists, as comps_objrtree_copy_shallow() does. Signed-off-by: hanjinpeng <hanjinpeng@kylinos.cn>
prownd
force-pushed
the
fix-double-free-after-comps_objmrtree_copy_shallow-s01
branch
from
October 27, 2026 12:42
5bf616a to
5e47d2b
Compare
Contributor
Author
|
Thanks, changed to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
comps_objmrtree_copy_shallow() copied the value lists of the first level, but put the very same lists (without taking a reference) into all deeper nodes, so destroying the copy freed lists still used by the original. MDict.copy() followed by deleting the copy crashed. Copy the lists on all levels.