diff --git a/src/Mod/Part/App/FT2FC.cpp b/src/Mod/Part/App/FT2FC.cpp index 24e8e739a6..0a0538d3b2 100644 --- a/src/Mod/Part/App/FT2FC.cpp +++ b/src/Mod/Part/App/FT2FC.cpp @@ -32,8 +32,6 @@ #ifndef _PreComp_ # include # include -# include -# include # include # include # include @@ -144,8 +142,8 @@ PyObject* FT2FC(const Py_UNICODE *PyUString, int bytesNeeded = fontfile.tellg(); fontfile.clear(); fontfile.seekg (0, fontfile.beg); - char* buffer = new char[bytesNeeded]; - fontfile.read(buffer, bytesNeeded); + auto buffer = std::unique_ptr (new char[bytesNeeded]); + fontfile.read(buffer.get(), bytesNeeded); if (!fontfile) { //get indignant ErrorMsg << "Can not read font file: " << FontSpec; @@ -153,7 +151,7 @@ PyObject* FT2FC(const Py_UNICODE *PyUString, } fontfile.close(); - const FT_Byte* ftBuffer = reinterpret_cast(buffer); + const FT_Byte* ftBuffer = reinterpret_cast(buffer.get()); error = FT_New_Memory_Face(FTLib, ftBuffer, bytesNeeded, FaceIndex, &FTFace); if (error) { ErrorMsg << "FT_New_Face failed: " << error;