frr icon indicating copy to clipboard operation
frr copied to clipboard

pimd: fix memory leaks in parent process after fork()

Open jaredmauch opened this issue 5 months ago • 3 comments

Fix memory leaks that occur when the parent process exits after fork() in frr_daemonize(). The parent process was not cleaning up memory allocated before fork(), specifically:

  • router structure allocated in pim_router_init()
  • MLAG resources (mlag_fifo and mlag_stream) allocated in pim_mlag_init()
  • zclient structures (pim_zclient and pim_zlookup) allocated in pim_zebra_init()

Add a new frr_parent_cleanup hook that is called in the parent process before it exits. Register pim_parent_cleanup() to free all PIM-specific resources in the parent process.

Also add NULL pointer checks in pim_mlag_terminate() to safely handle cases where MLAG was not initialized (e.g., pim6d).

Related PR: #18718

jaredmauch avatar Nov 13 '25 04:11 jaredmauch

No "merge" commits, please. Just rebase your commit to newer master as needed.

mjstapp avatar Nov 18 '25 16:11 mjstapp

@Mergifyio backport stable/10.5 stable/10.4 stable/10.3 stable/10.2

ton31337 avatar Nov 18 '25 16:11 ton31337

backport stable/10.5 stable/10.4 stable/10.3 stable/10.2

🟠 Waiting for conditions to match

  • [ ] merged [📌 backport requirement]

mergify[bot] avatar Nov 18 '25 16:11 mergify[bot]