diff --git a/src/c_consolebuffer.cpp b/src/c_consolebuffer.cpp index 9d32efffb..9868bc6c3 100644 --- a/src/c_consolebuffer.cpp +++ b/src/c_consolebuffer.cpp @@ -150,9 +150,9 @@ void FConsoleBuffer::AddText(int printlevel, const char *text, FILE *logfile) void FConsoleBuffer::WriteLineToLog(FILE *LogFile, const char *outline) { // Strip out any color escape sequences before writing to the log file - char * copy = new char[strlen(outline)+1]; + TArray copy(strlen(outline)+1); const char * srcp = outline; - char * dstp = copy; + char * dstp = copy.Data(); while (*srcp != 0) { @@ -193,8 +193,7 @@ void FConsoleBuffer::WriteLineToLog(FILE *LogFile, const char *outline) } *dstp=0; - fputs (copy, LogFile); - delete [] copy; + fputs (copy.Data(), LogFile); fflush (LogFile); } diff --git a/src/f_wipe.cpp b/src/f_wipe.cpp index 6d34936fd..25c283038 100644 --- a/src/f_wipe.cpp +++ b/src/f_wipe.cpp @@ -32,29 +32,24 @@ class FBurnTexture : public FTexture { - uint32_t *WorkBuffer; + TArray WorkBuffer; public: FBurnTexture(int w, int h) + : WorkBuffer(w*h, true) { Width = w; Height = h; - WorkBuffer = new uint32_t[w * h]; - } - - ~FBurnTexture() - { - delete [] WorkBuffer; } int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) override { - bmp->CopyPixelDataRGB(x, y, (uint8_t*)WorkBuffer, Width, Height, 4, Width*4, rotate, CF_RGBA, inf); + bmp->CopyPixelDataRGB(x, y, (uint8_t*)WorkBuffer.Data(), Width, Height, 4, Width*4, rotate, CF_RGBA, inf); return 0; } uint32_t *GetBuffer() { - return WorkBuffer; + return WorkBuffer.Data(); } };