Changed nsFilePicker::Show to set a larger buffer for the directory name string and make sure to free the memory returned by GetPath(),

bug 83345, r=law, sr=blizzard, a=blizzard.
This commit is contained in:
nhotta%netscape.com 2001-06-05 21:30:17 +00:00
Родитель 5892765fc6
Коммит d5a92356a7
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -100,10 +100,12 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
if (mMode == modeGetFolder) { if (mMode == modeGetFolder) {
char dirBuffer[MAX_PATH+1];
PL_strncpy(dirBuffer, initialDir, MAX_PATH);
BROWSEINFO browserInfo; BROWSEINFO browserInfo;
browserInfo.hwndOwner = mWnd; browserInfo.hwndOwner = mWnd;
browserInfo.pidlRoot = nsnull; browserInfo.pidlRoot = nsnull;
browserInfo.pszDisplayName = (LPSTR)initialDir; browserInfo.pszDisplayName = (LPSTR)dirBuffer;
browserInfo.lpszTitle = title; browserInfo.lpszTitle = title;
browserInfo.ulFlags = BIF_RETURNONLYFSDIRS;//BIF_STATUSTEXT | BIF_RETURNONLYFSDIRS; browserInfo.ulFlags = BIF_RETURNONLYFSDIRS;//BIF_STATUSTEXT | BIF_RETURNONLYFSDIRS;
browserInfo.lpfn = nsnull; browserInfo.lpfn = nsnull;
@ -211,6 +213,9 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
} }
if (initialDir)
nsMemory::Free(initialDir);
if (title) if (title)
nsMemory::Free( title ); nsMemory::Free( title );