Module: kamailio
Branch: 6.1
Commit: 0acd0f025c4e190b6252ad898fce8dd7bc4ac311
URL: 
https://github.com/kamailio/kamailio/commit/0acd0f025c4e190b6252ad898fce8dd7bc4ac311

Author: qasimloay <[email protected]>
Committer: Victor Seva <[email protected]>
Date: 2026-06-08T16:01:55+02:00

ims_registrar_pcscf: free leaked sec-agree security_t in save_pending()

save_pending() parses a Security-Client header (sec_params) and a
Security-Verify header (sec_verify_params) into shm-allocated security_t
structures, but only hands sec_params to the contact on the initial
registration path (via update_temp_security()).

- sec_verify_params is only used to copy the SPI/port values into
  sec_params and is never stored, so it leaked on every REGISTER carrying
  a Security-Verify header.
- sec_params leaked on every re-REGISTER (contact already exists) and on
  the DB_ONLY de-registration early-return paths, where it is never
  stored on the contact.

Track ownership with sec_params_stored and free both structures on the
paths where they are not handed to the contact. Introduce free_security_t()
(mirrors free_security() in ims_usrloc_pcscf/pcontact.c) and use it both
here and to replace the duplicated cleanup block in parse_sec_agree().

Related to #4671

(cherry picked from commit 5527cced2aa05856792ffc784b39c78394017673)

---

Modified: src/modules/ims_registrar_pcscf/save.c
Modified: src/modules/ims_registrar_pcscf/sec_agree.c
Modified: src/modules/ims_registrar_pcscf/sec_agree.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/0acd0f025c4e190b6252ad898fce8dd7bc4ac311.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0acd0f025c4e190b6252ad898fce8dd7bc4ac311.patch

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to