File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -146,9 +146,9 @@ TF_Buffer *Model::read(const std::string& filename) {
146146 file.seekg (0 , std::ios::beg);
147147
148148 // Read
149- auto data = new char [size] ;
149+ auto data = std::make_unique< char []>(size) ;
150150 file.seekg (0 , std::ios::beg);
151- file.read (data, size);
151+ file.read (data. get () , size);
152152
153153 // Error reading the file
154154 if (!file) {
@@ -158,11 +158,10 @@ TF_Buffer *Model::read(const std::string& filename) {
158158
159159
160160 // Create tensorflow buffer from read data
161- TF_Buffer* buffer = TF_NewBufferFromString (data, size);
161+ TF_Buffer* buffer = TF_NewBufferFromString (data. get () , size);
162162
163163 // Close file and remove data
164164 file.close ();
165- delete[] data;
166165
167166 return buffer;
168167}
You can’t perform that action at this time.
0 commit comments