From 44867a8c013a2ae6b828ef12af8e81cb73795483 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Mon, 2 Mar 2020 10:41:17 +0100 Subject: Modernize memory management Update internals of various classes. --- Source/CTest/cmParsePHPCoverage.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Source/CTest/cmParsePHPCoverage.cxx') diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx index a494b92b91..044f518ef0 100644 --- a/Source/CTest/cmParsePHPCoverage.cxx +++ b/Source/CTest/cmParsePHPCoverage.cxx @@ -3,6 +3,8 @@ #include #include +#include + #include "cmsys/Directory.hxx" #include "cmsys/FStream.hxx" @@ -142,17 +144,15 @@ bool cmParsePHPCoverage::ReadFileInformation(std::istream& in) int size = 0; if (this->ReadInt(in, size)) { size++; // add one for null termination - char* s = new char[size + 1]; + auto s = cm::make_unique(size + 1); // read open quote if (in.get(c) && c != '"') { - delete[] s; return false; } // read the string data - in.read(s, size - 1); + in.read(s.get(), size - 1); s[size - 1] = 0; - std::string fileName = s; - delete[] s; + std::string fileName = s.get(); // read close quote if (in.get(c) && c != '"') { cmCTestLog(this->CTest, ERROR_MESSAGE, -- cgit v1.2.1