[asterisk-bugs] [Asterisk 0010437]: memory leak in zt_new()

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Aug 13 09:00:22 CDT 2007


The following issue has been ASSIGNED. 
====================================================================== 
http://bugs.digium.com/view.php?id=10437 
====================================================================== 
Reported By:                haklin
Assigned To:                file
====================================================================== 
Project:                    Asterisk
Issue ID:                   10437
Category:                   Channels/chan_zap
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.10  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!): 79172 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             08-13-2007 07:33 CDT
Last Modified:              08-13-2007 09:00 CDT
====================================================================== 
Summary:                    memory leak in zt_new()
Description: 
zt_new() calls ast_channel_alloc() with cid_num, cid_name but later in
zt_new(), the following code is executed, which overwrites cid-stuff in the
"tmp-channel":

#ifdef PRI_ANI
	tmp->cid.cid_num = ast_strdup(i->cid_num);
	tmp->cid.cid_name = ast_strdup(i->cid_name);
	if (!ast_strlen_zero(i->cid_ani))
		tmp->cid.cid_ani = ast_strdup(i->cid_ani);
	else	
		tmp->cid.cid_ani = ast_strdup(i->cid_num);
#else
	tmp->cid.cid_num = ast_strdup(i->cid_num);
	tmp->cid.cid_ani = ast_strdup(i->cid_num);
	tmp->cid.cid_name = ast_strdup(i->cid_name);
#endif

In ast_channel_alloc() cid_num and cid_name are already set and a memory
leak occurs when the ast_strdup() above is executed.

====================================================================== 

---------------------------------------------------------------------- 
 svnbot - 08-13-07 09:00  
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 79174

------------------------------------------------------------------------
r79174 | file | 2007-08-13 09:00:21 -0500 (Mon, 13 Aug 2007) | 4 lines

(closes issue http://bugs.digium.com/view.php?id=10437)
Reported by: haklin
Don't set the callerid name and number a second time on a newly created
channel. ast_channel_alloc itself already sets it and setting it twice
would cause a memory leak.

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

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
08-13-07 09:00  svnbot         Note Added: 0068767                          
08-13-07 09:00  svnbot         Status                   new => assigned     
08-13-07 09:00  svnbot         Assigned To               => file            
======================================================================




More information about the asterisk-bugs mailing list