[Asterisk-Dev] App DISA2: strdup memory leaks?

Steven Critchfield critch at basesys.com
Sun Nov 2 18:48:22 MST 2003


On Sun, 2003-11-02 at 16:21, Steve Rodgers wrote:
> I've been spending some time studying the source code bacuse I want to rite 
> some of my own apps someday. Looking at the way the applications are 
> dynamically loaded and linked into the main code, it looks like any heap 
> memory allocated (malloc/strdup) by the apps would need to be freed before 
> the app terminated.  Please correct me if I'm wrong about this.

You are correct, and I was about to say the same thing.

cmdline is a pointer to some malloc()ed memory via strdup() and needs to
be free()ed before you exit the app. Ideally you would free it as soon
as you are done with it.
-- 
Steven Critchfield <critch at basesys.com>




More information about the asterisk-dev mailing list