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

Liviu Chircu liviu at opensips.org
Mon Sep 17 10:15:26 EDT 2018


  Branch: refs/heads/2.3
  Home:   https://github.com/OpenSIPS/opensips
  Commit: b22c3b68f75dc6f8c32f02f4d245473fac04238e
      https://github.com/OpenSIPS/opensips/commit/b22c3b68f75dc6f8c32f02f4d245473fac04238e
  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: 046c8b45ed23d9da5f1c74d4e5d27315f7e84e3e
      https://github.com/OpenSIPS/opensips/commit/046c8b45ed23d9da5f1c74d4e5d27315f7e84e3e
  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: 36dda811d0600b725c0a0c7be5a0bda3206abe19
      https://github.com/OpenSIPS/opensips/commit/36dda811d0600b725c0a0c7be5a0bda3206abe19
  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: 291c1fefa4835df594595c44d4a5516dc9709e41
      https://github.com/OpenSIPS/opensips/commit/291c1fefa4835df594595c44d4a5516dc9709e41
  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: 9c66c22dfe2a7ac04bef68d08987e3de47ca3163
      https://github.com/OpenSIPS/opensips/commit/9c66c22dfe2a7ac04bef68d08987e3de47ca3163
  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 invalid memory access

Similar to commit a223c82024.  Avoid returning a pointer to a freed pkg
memory area.

(cherry picked from commit 313a3438717f8cb790aec9703037b82a66db3f4f)


Compare: https://github.com/OpenSIPS/opensips/compare/0f29e72ec823...9c66c22dfe2a
      **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