[Home]

Summary:ASTERISK-12580: [patch] Memory leak while trying to free a not existent or moved pointer.
Reporter:Eliel Sardanons (eliel)Labels:
Date Opened:2008-08-14 13:22:17Date Closed:2008-08-14 13:38:51
Priority:MinorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_sqlite3_custom
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) sqlite.otheroption.patch
( 1) sqlite.patch
Description:While using strsep(pointer, separator) the pointer passed is being moved to the next element in the string separated by 'separator', so, we can't free(pointer).
We have two ways of fixing this:
1) Save the pointer before passing it to strsep.
2) Use ast_strdupa() instead of ast_strdup().

****** ADDITIONAL INFORMATION ******

I have attached both ways, cause I don't know how long is the string being duplicated and duplicating a long string in the frame stack is not so welcome.
Comments:By: Digium Subversion (svnbot) 2008-08-14 13:38:47

Repository: asterisk
Revision: 137933

U   trunk/cdr/cdr_sqlite3_custom.c

------------------------------------------------------------------------
r137933 | seanbright | 2008-08-14 13:38:44 -0500 (Thu, 14 Aug 2008) | 8 lines

Fix memory leak in cdr_sqlite3_custom.

(closes issue ASTERISK-12580)
Reported by: eliel
Patches:
     sqlite.patch uploaded by eliel (license 64)
     (Slightly modified by me)

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

http://svn.digium.com/view/asterisk?view=rev&revision=137933