Browse Source

Close files opened by read_triangle_mesh (#1915)

Co-authored-by: Martin Hafskjold Thoresen <[email protected]>
martinhath 3 years ago
parent
commit
36cb980cb3
1 changed files with 2 additions and 0 deletions
  1. 2 0
      include/igl/readPLY.cpp

+ 2 - 0
include/igl/readPLY.cpp

@@ -172,12 +172,14 @@ IGL_INLINE bool readPLY(
     std::vector<uint8_t> fileBufferBytes;
     std::vector<uint8_t> fileBufferBytes;
     read_file_binary(fp,fileBufferBytes);
     read_file_binary(fp,fileBufferBytes);
     file_memory_stream stream((char*)fileBufferBytes.data(), fileBufferBytes.size());
     file_memory_stream stream((char*)fileBufferBytes.data(), fileBufferBytes.size());
+    fclose(fp);
     return readPLY(stream,V,F,E,N,UV,VD,Vheader,FD,Fheader,ED,Eheader,comments);
     return readPLY(stream,V,F,E,N,UV,VD,Vheader,FD,Fheader,ED,Eheader,comments);
   }
   }
   catch(const std::exception& e)
   catch(const std::exception& e)
   {
   {
     std::cerr << "ReadPLY error: " << e.what() << std::endl;
     std::cerr << "ReadPLY error: " << e.what() << std::endl;
   }
   }
+  fclose(fp);
   return false;
   return false;
 }
 }