[asterisk-bugs] [LibPRI 0011469]: [patch] Use calloc() instead of malloc() + memset()

noreply at bugs.digium.com noreply at bugs.digium.com
Tue Dec 4 22:26:27 CST 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=11469 
====================================================================== 
Reported By:                eliel
Assigned To:                mattf
====================================================================== 
Project:                    LibPRI
Issue ID:                   11469
Category:                   General
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     assigned
Asterisk Version:            SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 487 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             12-04-2007 22:10 CST
Last Modified:              12-04-2007 22:26 CST
====================================================================== 
Summary:                    [patch] Use calloc() instead of malloc() + memset()
Description: 
Alloc the memory allready set to zero. And use the "pointer" way for the
sizeof() of a alloc.
example:
     malloc(sizeof(*p)) instead of malloc(sizeof(struct stname)) 
====================================================================== 

---------------------------------------------------------------------- 
 eliel - 12-04-07 22:26  
---------------------------------------------------------------------- 
in q931.c call_init() is called only from one place, so, we could avoid the
memset and use calloc in the place where the memory is being allocated.
Also, the memory is set to zero, so it is not necesary to initialize the
variables that will be 0. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
12-04-07 22:26  eliel          Note Added: 0074796                          
======================================================================




More information about the asterisk-bugs mailing list