[OpenSIPS-Devel] [OpenSIPS/opensips] 7b8205: sql_cacher: Fix several memleaks

Liviu Chircu liviu at opensips.org
Mon Sep 17 08:27:28 EDT 2018


  Branch: refs/heads/2.4
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 7b8205e3f7ec1dc002a89d5b886f1a49e7543436
      https://github.com/OpenSIPS/opensips/commit/7b8205e3f7ec1dc002a89d5b886f1a49e7543436
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-17 (Mon, 17 Sep 2018)

  Changed paths:
    M modules/sql_cacher/sql_cacher.c

  Log Message:
  -----------
  sql_cacher: Fix several memleaks

insert_in_cachedb():
    * fix pkg leak on failed CacheDB set
    * fix pkg leak when running oom

load_key():
    * [!] fix pkg leak on successful case (return 0)
    * fix two pkg leaks on failed CacheDB operation
    * fix pkg leak on bad table name

mi_reload():
    * fix pkg leak on failed CacheDB add

(cherry picked from commit 449e0371e7890ab4fb355586fec2e13c3f8c3db3)


  Commit: f74a57d32e524644cdf3bb84aa6a933172e6006a
      https://github.com/OpenSIPS/opensips/commit/f74a57d32e524644cdf3bb84aa6a933172e6006a
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-17 (Mon, 17 Sep 2018)

  Changed paths:
    M modules/sql_cacher/sql_cacher.c

  Log Message:
  -----------
  sql_cacher: Improve on_demand_load()

    * while loop: rewrite so we reduce indentation by 1 level
    * remove redundant code -- "if (!it) {" condition
  (this also drops code indentation by 1 level!  yay!)
    * fix pkg mem leak on NULL column or bad res type

(cherry picked from commit 827cee77b566f5d304b3bfeb9bd284cb770b8914)


  Commit: 631b05be3c3870aee3c1d49dc713285f0505524e
      https://github.com/OpenSIPS/opensips/commit/631b05be3c3870aee3c1d49dc713285f0505524e
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-17 (Mon, 17 Sep 2018)

  Changed paths:
    M modules/sql_cacher/sql_cacher.c
    M modules/sql_cacher/sql_cacher.h

  Log Message:
  -----------
  sql_cacher: Fix possible invalid memory access

This patch ensures that we properly duplicate (and later free) any
strings contained in SQL DB results before freeing these results and
returning the strings to the calling layers.

We also add the is_str_column() macro, which improves code readability.

(cherry picked from commit a223c820247398bc54f38aea5f6a9461d8500980)


  Commit: 2c79c8b85afd37ab4eddd48ef86f5a664f181709
      https://github.com/OpenSIPS/opensips/commit/2c79c8b85afd37ab4eddd48ef86f5a664f181709
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-17 (Mon, 17 Sep 2018)

  Changed paths:
    M modules/sql_cacher/sql_cacher.c

  Log Message:
  -----------
  sql_cacher: Minor optimization

Optimize the number of buffer realloc operations when fetching cached
values.

(cherry picked from commit 5516398fc63567ec13cb443c5009ad13473ac096)


  Commit: 9ad56bc5391efdcc6e3229b3cfc3ef99cb875b50
      https://github.com/OpenSIPS/opensips/commit/9ad56bc5391efdcc6e3229b3cfc3ef99cb875b50
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-17 (Mon, 17 Sep 2018)

  Changed paths:
    M dset.c

  Log Message:
  -----------
  core: Fix poor oom handling

When nearing oom, any failed branch buffer allocations could lead to a
crash due to a lingering freed pointer.

Thanks to Răzvan for helping catch this one!

(cherry picked from commit c2f8b9807837bd8dd143a33cb555b050fb7a8d72)


Compare: https://github.com/OpenSIPS/opensips/compare/113973a7b70c...9ad56bc5391e
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the Devel mailing list