[asterisk-bugs] [Asterisk 0010310]: Invalid free of connection pointer

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Jul 26 12:34:48 CDT 2007


The following issue has been set as RELATED TO issue 0010295. 
====================================================================== 
http://bugs.digium.com/view.php?id=10310 
====================================================================== 
Reported By:                prashant_jois
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   10310
Category:                   CDR/cdr_pgsql
Reproducibility:            random
Severity:                   crash
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.9  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             07-26-2007 12:14 CDT
Last Modified:              07-26-2007 12:16 CDT
====================================================================== 
Summary:                    Invalid free of connection pointer
Description: 
This may or may not cause a crash, but invalid memory is being accessed on
failure to connect to the PGSQL database.  

Specifically -

lines 88-92:

   pgerror = PQerrorMessage(conn);
   PQfinish(conn);
   ast_log(LOG_ERROR, "cdr_pgsql: Unable to connect to database server %s.
Calls will not be logged!\n", pghostname);
   ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);

---------------

PQfinish should come after line 92, because pgerror is a pointer to one of
the fields in conn:


   pgerror = PQerrorMessage(conn);
   ast_log(LOG_ERROR, "cdr_pgsql: Unable to connect to database server %s.
Calls will not be logged!\n", pghostname);
   ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
   PQfinish(conn);

---------------

The same goes for lines 148-152. It should be:

   pgerror = PQerrorMessage(conn);
   ast_log(LOG_ERROR, "cdr_pgsql: Unable to reconnect to database server
%s. Calls will not be logged!\n", pghostname);
   ast_log(LOG_ERROR, "cdr_pgsql: Reason: %s\n", pgerror);
   PQfinish(conn);


======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0010295 segfault on reload
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-26-07 12:34  qwell          Relationship added       related to 0010295  
======================================================================




More information about the asterisk-bugs mailing list