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,7 +216,13 @@ void wxPathList::AddEnvList (const wxString& envVariable)
{ {
static const wxChar PATH_TOKS[] = static const wxChar PATH_TOKS[] =
#ifdef __WINDOWS__ #ifdef __WINDOWS__
wxT(" ;"); // Don't seperate with colon in DOS (used for drive) /*
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 #else
wxT(" :;"); wxT(" :;");
#endif #endif
@@ -229,11 +235,14 @@ void wxPathList::AddEnvList (const wxString& envVariable)
if (token) if (token)
{ {
Add (copystring (token)); Add(token);
while (token) while (token)
{ {
if ((token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr)) != NULL) if ( (token = wxStrtok ((wxChar *) NULL, PATH_TOKS, &save_ptr))
Add (wxString(token)); != NULL )
{
Add(token);
}
} }
} }