[OpenSIPS-Devel] [OpenSIPS/opensips] 03f64d: cfgutils: Fix SHM leak with re.subst and $shv() va...

Liviu Chircu noreply at github.com
Wed Jun 17 11:08:38 UTC 2026


  Branch: refs/heads/4.0
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 03f64d954e43f7ac91270b7496a2e1dbec34d11e
      https://github.com/OpenSIPS/opensips/commit/03f64d954e43f7ac91270b7496a2e1dbec34d11e
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2026-06-17 (Wed, 17 Jun 2026)

  Changed paths:
    M modules/cfgutils/shvar.c
    M pvar.c
    M pvar.h
    M re.c

  Log Message:
  -----------
  cfgutils: Fix SHM leak with re.subst and $shv() variables

The re.subst transformation stores replacement-side PV specs by value inside
its cached subst_expr.  When the cached expression is replaced, the embedded
$shv() spec could leave behind its shared-memory pvv buffer.

This can be triggered with a dynamic substitution expression such as:

    $var(re) = "/^s=before/s=$shv(voip_sdp_session)\r/g";
    $var(sdp) = $(var(sdp){re.subst,$var(re)});

Track pvv ownership, mark $shv() buffers as SHM-owned, and release them when
freeing cached re.subst replacement specs.

Fixes #3872

(cherry picked from commit 09ec06179c8c40d034e8eb27fe814f15418f58b6)



To unsubscribe from these emails, change your notification settings at https://github.com/OpenSIPS/opensips/settings/notifications



More information about the Devel mailing list