[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:

Review request for Asterisk Developers.


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.


  /branches/1.8/cel/cel_pgsql.c 347950 

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


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.



-------------- 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