Summary:ASTERISK-09719: Memory leaks in cdr_pgsql
Reporter:Prashant Jois (prashant_jois)Labels:
Date Opened:2007-06-20 14:32:44Date Closed:2007-06-20 18:33:11
Versions:Frequency of
Environment:Attachments:( 0) cdr_pgsql.diff
Description:The main memory leaks were fixed in 1.4.5 but a few still remain.

1. cdr_pgsql.c line 165: PQexec is called here, but the PGresult pointer was not freed from the previous call on line 155.  Thus we need another PQclear(result) between lines 164 and 165.

2. cdr_pgsql.c lines 91 and 280: On failure to connect to the database, PQfinish must be called on the PGconn pointer to free the memory allocated for it.  This should also be done on line 150 because the connection is being discarded.


Attached is patch file (cdr_pgsql.diff) for cdr_pgsql.c for Asterisk 1.4.5 (I don't think this area gets looked at very often so I'm assuming it hasn't been fixed already in the trunk).
Comments:By: Jason Parker (jparker) 2007-06-20 18:33:11

Fixed in svn branches 1.4 and trunk in revisions 70612 and 70613.