fix memory leak as Dimitri suggested

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Chris Elliott
2003-03-21 10:10:16 +00:00
parent ac0c4cc396
commit db4444f0ce

View File

@@ -216,6 +216,12 @@ void wxPathList::AddEnvList (const wxString& envVariable)
{
static const wxChar PATH_TOKS[] =
#ifdef __WINDOWS__
/*
The space has been removed from the tokenizers, otherwise a
path such as "C:\Program Files" would be split into 2 paths:
"C:\Program" and "Files"
*/
// wxT(" ;"); // Don't seperate with colon in DOS (used for drive)
wxT(";"); // Don't seperate with colon in DOS (used for drive)
#else
wxT(" :;");
@@ -229,11 +235,14 @@ void wxPathList::AddEnvList (const wxString& envVariable)
if (token)
{
Add (copystring (token));
Add(token);
while (token)
{
if ((token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr)) != NULL)
Add (wxString(token));
if ( (token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr))
!= NULL )
{
Add(token);
}
}
}