Skip to content

fix: improve memory management and code style#17984

Closed
glepnir wants to merge 1 commit intovim:masterfrom
glepnir:mem_ref
Closed

fix: improve memory management and code style#17984
glepnir wants to merge 1 commit intovim:masterfrom
glepnir:mem_ref

Conversation

@glepnir
Copy link
Copy Markdown
Member

@glepnir glepnir commented Aug 13, 2025

Problem:

  • Missing cleanup of lmatchpos lists causing memory leaks
  • Missing error handling for list operations
  • Use of malloc() instead of Vim's alloc() functions
  • Inconsistent C-style comments
  • Missing null pointer checks for memory allocation
  • Incorrect use of vim_free() for list objects

Solution:

  • Add proper cleanup of lmatchpos in done section using list_free()
  • Set lmatchpos to NULL after successful transfer to avoid confusion
  • Add error handling for list_append_tv() failures
  • Replace malloc() with alloc() and add null pointer checks
  • Convert C-style comments to C++ style for consistency
  • Fix vim_free() calls to use list_free() for list objects

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects
@chrisbra
Copy link
Copy Markdown
Member

thanks

@chrisbra chrisbra closed this in 17a6d69 Aug 13, 2025
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Aug 13, 2025
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: vim/vim#17984

vim/vim@17a6d69

Co-authored-by: glepnir <[email protected]>
yochem pushed a commit to yochem/neovim that referenced this pull request Aug 23, 2025
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: vim/vim#17984

vim/vim@17a6d69

Co-authored-by: glepnir <[email protected]>
sahinf pushed a commit to sahinf/vim that referenced this pull request Sep 7, 2025
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: vim#17984

Signed-off-by: glepnir <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
dundargoc pushed a commit to dundargoc/neovim that referenced this pull request Sep 27, 2025
Problem:  fuzzy.c has a few issues
Solution: Use Vims memory management, update style
          (glepnir)

Problem:
- Missing cleanup of lmatchpos lists causing memory leaks
- Missing error handling for list operations
- Use of malloc() instead of Vim's alloc() functions
- Inconsistent C-style comments
- Missing null pointer checks for memory allocation
- Incorrect use of vim_free() for list objects

Solution:
- Add proper cleanup of lmatchpos in done section using list_free()
- Set lmatchpos to NULL after successful transfer to avoid confusion
- Add error handling for list_append_tv() failures
- Replace malloc() with alloc() and add null pointer checks
- Convert C-style comments to C++ style for consistency
- Fix vim_free() calls to use list_free() for list objects

closes: vim/vim#17984

vim/vim@17a6d69

Co-authored-by: glepnir <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants