Merge pull request #597 from LegalizeAdulthood/cppcheck-leaks
Fix leaks found by cppcheckpull/600/head
commit
09b534c45e
|
@ -482,8 +482,9 @@ aiReturn aiMaterial::AddBinaryProperty (const void* pInput,
|
||||||
|
|
||||||
aiMaterialProperty** ppTemp;
|
aiMaterialProperty** ppTemp;
|
||||||
try {
|
try {
|
||||||
ppTemp = new aiMaterialProperty*[mNumAllocated];
|
ppTemp = new aiMaterialProperty*[mNumAllocated];
|
||||||
} catch (std::bad_alloc&) {
|
} catch (std::bad_alloc&) {
|
||||||
|
delete pcNew;
|
||||||
return AI_OUTOFMEMORY;
|
return AI_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -892,12 +892,33 @@ int Assimp_CompareDump (const char* const* params, unsigned int num)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* actual = fopen(params[0],"rb"), *expected = fopen(params[1],"rb");
|
class file_ptr
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
file_ptr(FILE *p)
|
||||||
|
: m_file(p)
|
||||||
|
{}
|
||||||
|
~file_ptr()
|
||||||
|
{
|
||||||
|
if (m_file)
|
||||||
|
{
|
||||||
|
fclose(m_file);
|
||||||
|
m_file = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
operator FILE *() { return m_file; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
FILE *m_file;
|
||||||
|
};
|
||||||
|
file_ptr actual(fopen(params[0],"rb"));
|
||||||
if (!actual) {
|
if (!actual) {
|
||||||
std::cout << "assimp cmpdump: Failure reading ACTUAL data from " <<
|
std::cout << "assimp cmpdump: Failure reading ACTUAL data from " <<
|
||||||
params[0] << std::endl;
|
params[0] << std::endl;
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
file_ptr expected(fopen(params[1],"rb"));
|
||||||
if (!expected) {
|
if (!expected) {
|
||||||
std::cout << "assimp cmpdump: Failure reading EXPECT data from " <<
|
std::cout << "assimp cmpdump: Failure reading EXPECT data from " <<
|
||||||
params[1] << std::endl;
|
params[1] << std::endl;
|
||||||
|
|
Loading…
Reference in New Issue