[asterisk-dev] [Code Review] Fix memory leaks in cel_pgsql

Matt Jordan reviewboard at asterisk.org
Thu Dec 15 17:11:08 CST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1624/
-----------------------------------------------------------

Review request for Asterisk Developers.


Summary
-------

There were a number of issues in cel_pgsql's pgsql_log method.
* If either sql or sql2 (both ast_str structs) could not be allocated, the method would return while the pgsql_lock was still locked
* If the execution of the log statement succeeded, the sql and sql2 ast_str structs were never free'd
* Reconnections were logged as ERRORs, etc.

This patch does some cleanup in pgsql_log to better handle the resource cleanup at the end of the method and to make better use of WARNING and NOTICEs where appropriate.


This addresses bug ASTERISK-18879.
    https://issues.asterisk.org/jira/browse/ASTERISK-18879


Diffs
-----

  /branches/1.8/cel/cel_pgsql.c 347950 

Diff: https://reviewboard.asterisk.org/r/1624/diff


Testing
-------

Tested using CEL with postgresql.  Tested that memory leaks did not occur when a record could not be inserted, as well as when a record was inserted.


Thanks,

Matt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20111215/88516a31/attachment.htm>


More information about the asterisk-dev mailing list