Skip to content

Fix multiple memory leaks in daemon shutdown and JSON handling#72

Open
myungjoo wants to merge 3 commits intomainfrom
cursor/memory-leak-analysis-95a7
Open

Fix multiple memory leaks in daemon shutdown and JSON handling#72
myungjoo wants to merge 3 commits intomainfrom
cursor/memory-leak-analysis-95a7

Conversation

@myungjoo
Copy link
Member

@myungjoo myungjoo commented Mar 17, 2026

Summary

  • fix a leak in _resolve_rpk_path_in_json() by adding cleanup on early-return/error paths so allocated JsonNode objects are released
  • store and release DBus name ownership IDs to avoid leaking name-owner handles created via g_bus_own_name_on_connection()
  • free module list nodes in exit_modules() to release GList allocations during daemon shutdown
  • rewrite each leak-fix commit message to include a per-commit summary body and Signed-off-by

Commits

  • 0433857 Fix JSON node leak on early return paths
  • 63abac7 Release DBus name owner to avoid handle leak
  • 9a6f976 Free module list nodes during shutdown

Validation

  • attempted local build/test with meson setup build && meson test -C build
  • environment limitation: meson is not installed on this runner (meson: command not found)

Notes

  • no changes were made to underlying external libraries (e.g., gstreamer, glibc)
Open in Web Open in Cursor 

@myungjoo
Copy link
Member Author

All look legit.

@cursor cursor bot force-pushed the cursor/memory-leak-analysis-95a7 branch from daccb93 to 9a6f976 Compare March 17, 2026 05:43
@myungjoo myungjoo force-pushed the cursor/memory-leak-analysis-95a7 branch from 9a6f976 to b1a16cb Compare March 17, 2026 08:18
cursoragent and others added 3 commits March 18, 2026 06:18
- add centralized cleanup branches for error/early-return paths in _resolve_rpk_path_in_json()
- ensure app_info_node is reset per loop iteration and freed exactly once
- release root JSON node on out_err path to prevent leaked JsonNode allocations

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
- persist the owner id returned by g_bus_own_name_on_connection()
- unown previously owned name before reacquiring to avoid dangling owner handles
- release owned DBus name during gdbus_put_system_connection() shutdown path

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
- free the GList container allocated via add_module() during exit_modules()
- reset module_head to NULL after g_list_free() to avoid stale pointer reuse
- keep module->exit callbacks unchanged while eliminating module list node leak

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: MyungJoo Ham <myungjoo.ham@samsung.com>
@cursor cursor bot force-pushed the cursor/memory-leak-analysis-95a7 branch from b1a16cb to 1ddb727 Compare March 18, 2026 06:19
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.

2 participants