Skip to content

Commit

Permalink
Merge pull request #296 from mmohrhard/master
Browse files Browse the repository at this point in the history
fix memory leak
  • Loading branch information
fabrobinet committed Jul 7, 2014
2 parents c465914 + 5f7920f commit 7e80104
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 7 additions & 4 deletions converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,21 @@ namespace GLTF
asset->setExtras(this->_extraDataHandler->allExtras());
asset->prepareForProfile(shared_ptr <GLTFWebGL_1_0_Profile> (new GLTFWebGL_1_0_Profile()));

COLLADAFW::Root root(&this->_loader, this);
COLLADAFW::Root root(&this->_loader, this);
this->_loader.registerExtraDataCallbackHandler(this->_extraDataHandler);
if (!root.loadDocument(asset->getInputFilePath()))
return false;
if (!root.loadDocument(asset->getInputFilePath())) {
delete _extraDataHandler;
return false;
}

asset->write();

// Cleanup IDs and Technique cache in case we have another conversion
GLTFUtils::resetIDCount();
clearCommonProfileTechniqueCache();

return true;
delete _extraDataHandler;
return true;
}

//--------------------------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions converter/COLLADA2GLTF/shaders/commonProfileShaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ namespace GLTF
this->_profile = profile;
this->_instanceProgram = new GLSLProgram(profile);
}

~Pass() {
delete _instanceProgram;
}

GLSLProgram* instanceProgram() {
return this->_instanceProgram;
Expand Down Expand Up @@ -1207,6 +1211,10 @@ namespace GLTF
vertexShader->appendCode("}\n");
fragmentShader->appendCode("}\n");
}

~Technique() {
delete _pass;
}

shared_ptr <GLTF::JSONObject> parameters() {
return _parameters;
Expand Down

0 comments on commit 7e80104

Please sign in to comment.