Browse Source

Bugfix: Memory leak fixed.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@394 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
kimmi 16 năm trước cách đây
mục cha
commit
85a14fa265
2 tập tin đã thay đổi với 4 bổ sung7 xóa
  1. 3 3
      code/ObjFileParser.cpp
  2. 1 4
      code/ObjFileParser.h

+ 3 - 3
code/ObjFileParser.cpp

@@ -124,7 +124,7 @@ void ObjFileParser::parseFile()
 				{
 				{
 					// Read in normal vector definition
 					// Read in normal vector definition
 					++m_DataIt;
 					++m_DataIt;
-					getVector3(m_pModel->m_Normals);
+					getVector3( m_pModel->m_Normals );
 				}
 				}
 			}
 			}
 			break;
 			break;
@@ -216,7 +216,7 @@ void ObjFileParser::copyNextLine(char *pBuffer, size_t length)
 
 
 // -------------------------------------------------------------------
 // -------------------------------------------------------------------
 //	Get values for a new 3D vector instance
 //	Get values for a new 3D vector instance
-void ObjFileParser::getVector3(std::vector<aiVector3D*> &point3d_array)
+void ObjFileParser::getVector3(std::vector<aiVector3D> &point3d_array)
 {
 {
 	float x, y, z;
 	float x, y, z;
 	copyNextWord(m_buffer, BUFFERSIZE);
 	copyNextWord(m_buffer, BUFFERSIZE);
@@ -228,7 +228,7 @@ void ObjFileParser::getVector3(std::vector<aiVector3D*> &point3d_array)
 	copyNextWord(m_buffer, BUFFERSIZE);
 	copyNextWord(m_buffer, BUFFERSIZE);
 	z = (float) fast_atof(m_buffer);
 	z = (float) fast_atof(m_buffer);
 
 
-	point3d_array.push_back(new aiVector3D(x,y,z));
+	point3d_array.push_back( aiVector3D( x, y, z ) );
 	//skipLine();
 	//skipLine();
 	m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
 	m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
 }
 }

+ 1 - 4
code/ObjFileParser.h

@@ -47,9 +47,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <map>
 #include <map>
 #include "../include/aiTypes.h"
 #include "../include/aiTypes.h"
 
 
-/*struct aiVector2D_t;
-struct aiVector3D_t;*/
-
 namespace Assimp
 namespace Assimp
 {
 {
 
 
@@ -89,7 +86,7 @@ private:
 	///	Method to copy the new line.
 	///	Method to copy the new line.
 	void copyNextLine(char *pBuffer, size_t length);
 	void copyNextLine(char *pBuffer, size_t length);
 	///	Stores the following 3d vector.
 	///	Stores the following 3d vector.
-	void getVector3( std::vector<aiVector3D*> &point3d_array );
+	void getVector3( std::vector<aiVector3D> &point3d_array );
 	///	Stores the following 3d vector.
 	///	Stores the following 3d vector.
 	void getVector2(std::vector<aiVector2D*> &point2d_array);
 	void getVector2(std::vector<aiVector2D*> &point2d_array);
 	///	Stores the following face.
 	///	Stores the following face.