Summary:ASTERISK-05377: ResetCDR(w) crashes asterisk in case of linked cdrs
Reporter:Joerg Wolf (jwg)Labels:
Date Opened:2005-10-27 08:18:45Date Closed:2008-01-15 15:52:26.000-0600
Versions:Frequency of
Environment:Attachments:( 0) cdr.c.patch
Description:If ResetCDR(w) is called on a channel that has more than one CDR attached (e.g. after an call transfer occured), asterisk will crash sooner or later due to problems with heap memory. See also: http://bugs.digium.com/view.php?id=5340

This is obviously caused by ast_cdr_dup() which duplicates only the given cdr but not it's linked siblings. All other ast_cdr_* function will always iterate through the entire linked list of cdrs, so for example subsequent calls of ast_free_cdr()  will result in attempts to free the same memory twice...

A patch is attached that does the missing copies recursively.
Comments:By: Olle Johansson (oej) 2005-10-27 08:35:28

I suspect this is the bug we've been trying to find for weeks...

By: Mark Spencer (markster) 2005-10-27 18:05:14

The patch isn't right, but you definitely found the problem!  I've committed the one-line fix to actually take care of it.

By: Digium Subversion (svnbot) 2008-01-15 15:52:26.000-0600

Repository: asterisk
Revision: 6869

U   trunk/cdr.c

r6869 | markster | 2008-01-15 15:52:25 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix CDR crash (bug ASTERISK-5377 and many others)