From e44d5a589225b279532493019f0058b66c7afe23 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 19 Oct 2006 11:58:48 +0000 Subject: [PATCH] fix memory leak in wxGetTempFileName(const wxString&, wxString&) overload; also define wxGetTempFileName(const wxString&, wxChar *) overload in terms of the other one and not vice versa git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/filefn.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index df91e1cb4e..004dc02158 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -1280,9 +1280,8 @@ bool wxDirExists(const wxChar *pszPathName) // Get a temporary filename, opening and closing the file. wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf) { -#if wxUSE_FILE - wxString filename = wxFileName::CreateTempFileName(prefix); - if ( filename.empty() ) + wxString filename; + if ( !wxGetTempFileName(prefix, filename) ) return NULL; if ( buf ) @@ -1291,19 +1290,20 @@ wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf) buf = MYcopystring(filename); return buf; -#else - wxUnusedVar(prefix); - wxUnusedVar(buf); - // wxFileName::CreateTempFileName needs wxFile class enabled - return NULL; -#endif } bool wxGetTempFileName(const wxString& prefix, wxString& buf) { +#if wxUSE_FILE buf = wxGetTempFileName(prefix); return !buf.empty(); +#else // !wxUSE_FILE + wxUnusedVar(prefix); + wxUnusedVar(buf); + + return false; +#endif // wxUSE_FILE/!wxUSE_FILE } // Get first file name matching given wild card. -- 2.45.2