diff options
author | nyamatongwe <unknown> | 2001-06-16 02:51:29 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-06-16 02:51:29 +0000 |
commit | aa442dbc162c0b0f5026e15030292d080111699f (patch) | |
tree | aa93ee8e406181519d2ff0d3771267c233daa877 | |
parent | cc240f993c2b50936c1b8f634ed60d26a48ab66b (diff) | |
download | scintilla-mirror-aa442dbc162c0b0f5026e15030292d080111699f.tar.gz |
Patch from John for off-by-one allocation size error.
Changed from malloc/free to new/delete.
-rw-r--r-- | gtk/ScintillaGTK.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 6619775e1..522583351 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -857,7 +857,7 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) { #ifdef _MSC_VER /* Need to convert \n to correct newline form for this file as win32gtk always returns */ /* only \n line delimiter from clipboard */ - char *tmpstr = (char *) malloc(2 * len); + char *tmpstr = new char [2 * len]; char *dptr = tmpstr; char *sptr = ptr; unsigned int newlen = len; @@ -898,7 +898,7 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) { } pdoc->EndUndoAction(); #ifdef _MSC_VER - free(tmpstr); + delete []tmpstr; #endif } } @@ -949,7 +949,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, ch // win32gtk requires \n delimited lines and doesn't work right with // other line formats, so make a copy of the clip text now with // newlines converted - char *tmpstr = (char *) malloc(strlen(selBuffer)); + char *tmpstr = new char[strlen(selBuffer) + 1]; char *sptr = selBuffer; char *dptr = tmpstr; while (*sptr != '\0') { @@ -998,7 +998,7 @@ void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, ch delete []tmpBuffer; #ifdef _MSC_VER - free(tmpstr); + delete []tmpstr; #endif } |