use of malloc and free (given to shared ptr) for correct mem management
parent
9d2a1ca047
commit
5b4b16f360
|
@ -57,7 +57,7 @@ namespace Assimp {
|
||||||
*/
|
*/
|
||||||
#define IMPL_STRUCT_ALLOC(ty) \
|
#define IMPL_STRUCT_ALLOC(ty) \
|
||||||
uint8_t *alloc##ty(const size_t cnt) { \
|
uint8_t *alloc##ty(const size_t cnt) { \
|
||||||
return new uint8_t[cnt * sizeof(ty)]; \
|
return static_cast<uint8_t *>(malloc(cnt * sizeof(ty))); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,7 +172,7 @@ namespace Assimp {
|
||||||
const CustomDataTypeDescription cdtd = customDataTypeDescriptions[cdtype];
|
const CustomDataTypeDescription cdtd = customDataTypeDescriptions[cdtype];
|
||||||
if (cdtd.Read && cdtd.Alloc) {
|
if (cdtd.Read && cdtd.Alloc) {
|
||||||
// allocate cnt elements and parse them from file
|
// allocate cnt elements and parse them from file
|
||||||
out.reset(cdtd.Alloc(cnt));
|
out.reset(cdtd.Alloc(cnt), free);
|
||||||
return cdtd.Read(out.get(), cnt, db);
|
return cdtd.Read(out.get(), cnt, db);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue