[OpenSIPS-Devel] [OpenSIPS/opensips] 449e03: sql_cacher: Fix several memleaks

Liviu Chircu liviu at opensips.org
Fri Sep 14 11:39:13 EDT 2018


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 449e0371e7890ab4fb355586fec2e13c3f8c3db3
      https://github.com/OpenSIPS/opensips/commit/449e0371e7890ab4fb355586fec2e13c3f8c3db3
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-14 (Fri, 14 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


  Commit: 827cee77b566f5d304b3bfeb9bd284cb770b8914
      https://github.com/OpenSIPS/opensips/commit/827cee77b566f5d304b3bfeb9bd284cb770b8914
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-14 (Fri, 14 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


  Commit: a223c820247398bc54f38aea5f6a9461d8500980
      https://github.com/OpenSIPS/opensips/commit/a223c820247398bc54f38aea5f6a9461d8500980
  Author: Liviu Chircu <liviu at opensips.org>
  Date:   2018-09-14 (Fri, 14 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.


Compare: https://github.com/OpenSIPS/opensips/compare/6fcbcc816b6d...a223c8202473
      **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