From aa442dbc162c0b0f5026e15030292d080111699f Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 16 Jun 2001 02:51:29 +0000 Subject: Patch from John for off-by-one allocation size error. Changed from malloc/free to new/delete. --- gtk/ScintillaGTK.cxx | 8 ++++---- 1 file 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 } -- cgit v1.2.3