[asterisk-bugs] [Asterisk 0013864]: [patch] Fix a memory leak while trying to free a memory that wasn't allocated by ast_alloc_region()
Asterisk Bug Tracker
noreply at bugs.digium.com
Mon Nov 10 12:04:26 CST 2008
The following issue has been RESOLVED.
======================================================================
http://bugs.digium.com/view.php?id=13864
======================================================================
Reported By: eliel
Assigned To: svnbot
======================================================================
Project: Asterisk
Issue ID: 13864
Category: General
Reproducibility: have not tried
Severity: minor
Priority: normal
Status: resolved
Asterisk Version: SVN
SVN Branch (only for SVN checkouts, not tarball releases): trunk
SVN Revision (number only!): 155506
Disclaimer on File?: N/A
Request Review:
Resolution: fixed
Fixed in Version:
======================================================================
Date Submitted: 2008-11-07 21:56 CST
Last Modified: 2008-11-10 12:04 CST
======================================================================
Summary: [patch] Fix a memory leak while trying to free a
memory that wasn't allocated by ast_alloc_region()
Description:
This leak occurs if MALLOC_DEBUG is *enabled*
function filename_completion_function() inside complete_fn() (main/cli.c)
is returning a memory not allocated by ast_alloc_region() if MALLOC_DEBUG
is enabled, and we are trying to free it with a call to ast_free_region(),
so the pointer is not found and not freed.
The solution could be to let readline.c allocate the memory with
ast_alloc_region() (#include "asterisk.h"), the problem is that we must be
sure that we will not free memory allocated in this manner from other part
of 'editline', cause we will generate another memory leak (though).
Other thing could be to not set free() to ast_free() so we will be able to
handle this situations with a call to free() (right now being replaced to a
call to ast_free()) when we know that the source of the pointer is "in some
point" external to asterisk.
======================================================================
----------------------------------------------------------------------
(0094713) svnbot (reporter) - 2008-11-10 12:04
http://bugs.digium.com/view.php?id=13864#c94713
----------------------------------------------------------------------
Repository: asterisk
Revision: 155763
U trunk/main/editline/readline.c
------------------------------------------------------------------------
r155763 | tilghman | 2008-11-10 12:04:25 -0600 (Mon, 10 Nov 2008) | 6
lines
Fix memory leak when MALLOC_DEBUG is enabled.
(closes issue http://bugs.digium.com/view.php?id=13864)
Reported by: eliel
Patches:
readline.c.patch uploaded by eliel (license 64)
------------------------------------------------------------------------
http://svn.digium.com/view/asterisk?view=rev&revision=155763
Issue History
Date Modified Username Field Change
======================================================================
2008-11-10 12:04 svnbot Checkin
2008-11-10 12:04 svnbot Note Added: 0094713
2008-11-10 12:04 svnbot Status new => resolved
2008-11-10 12:04 svnbot Resolution open => fixed
2008-11-10 12:04 svnbot Assigned To => svnbot
======================================================================
More information about the asterisk-bugs
mailing list