X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/259d1674f293dcb7bbc0fa1c38392d899ce71bc0..4df78dc36e933fb1c3aa7c9d7ae2757a898ae05c:/src/html/search.cpp?ds=sidebyside diff --git a/src/html/search.cpp b/src/html/search.cpp index 506f382db7..175e50d44d 100644 --- a/src/html/search.cpp +++ b/src/html/search.cpp @@ -35,8 +35,8 @@ void wxSearchEngine::LookFor(const wxString& keyword) { - if (m_Keyword) free(m_Keyword); - m_Keyword = (char*) malloc(keyword.Length() + 1); + if (m_Keyword) delete[] m_Keyword; + m_Keyword = new char[keyword.Length() + 1]; strcpy(m_Keyword, keyword.c_str()); for (int i = strlen(m_Keyword) - 1; i >= 0; i--) if ((m_Keyword[i] >= 'A') && (m_Keyword[i] <= 'Z')) @@ -53,7 +53,7 @@ bool wxSearchEngine::Scan(wxInputStream *stream) int lng = stream ->GetSize(); int wrd = strlen(m_Keyword); bool found = FALSE; - char *buf = (char*) malloc(lng + 1); + char *buf = new char[lng + 1]; stream -> Read(buf, lng); buf[lng] = 0; @@ -66,7 +66,7 @@ bool wxSearchEngine::Scan(wxInputStream *stream) if (j == wrd) {found = TRUE; break;} } - free(buf); + delete[] buf; return found; }