[OpenSIPS-Devel] [OpenSIPS/opensips] ca968c: siprec: fix memory leaking while setting the same ...

Răzvan Crainea noreply at github.com
Wed Sep 27 15:05:11 UTC 2023


  Branch: refs/heads/3.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: ca968c21af1c9ea9f9f21480a93651ff9225e6d2
      https://github.com/OpenSIPS/opensips/commit/ca968c21af1c9ea9f9f21480a93651ff9225e6d2
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M modules/siprec/siprec_var.c

  Log Message:
  -----------
  siprec: fix memory leaking while setting the same field of siprec var

Credits go to Rob Moore, Daniel Bryars and Steven Ayre from Dubber, as
well as Liviu Chircu from the OpenSIPS team for working together to spot
this leak.

(cherry picked from commit 1dde47b524e4bb27e992ede2b15631eb12092537)


  Commit: e031651215b35b73a0a0cb7c71a37689d76717d3
      https://github.com/OpenSIPS/opensips/commit/e031651215b35b73a0a0cb7c71a37689d76717d3
  Author: Razvan Crainea <razvan at opensips.org>
  Date:   2023-09-27 (Wed, 27 Sep 2023)

  Changed paths:
    M statistics.c

  Log Message:
  -----------
  [WIP] statistics: fix crash when creating a series stat

Under normal circumstances, when a statistic is updated, we first search
whether it exists, and if not, we add it to the statistics hash.
However, due to the way it is implemented, searching and adding a
statistic is not atomic, hence, with high concurrency, when adding a new
statistic, we might already find an existing one there. In this case,
the code tries to return that statistic in the `pvar` parameter -
however, that parameter might be a (r/o) function, hence a crash
happens. This commit fixes the crash. Close #3136

However, it returns 0, as if the statistic was properly added - the
problem with this approach is that from the caller's perspective, we do
not know whether the statistic was already there or not, to free the
existing structure - hence this might result into a leak. We are still
working on a solution for this.

(cherry picked from commit 4640465215f131592326363bd0748d9f0e79f04d)


Compare: https://github.com/OpenSIPS/opensips/compare/4993bf7b1799...e031651215b3



More information about the Devel mailing list