Fixed memory allocation in detail mesh and memcpy in polymesh copy
This commit is contained in:
parent
eacaa87d9a
commit
480f56e94d
@ -1537,7 +1537,7 @@ bool rcCopyPolyMesh(rcContext* ctx, const rcPolyMesh& src, rcPolyMesh& dst)
|
|||||||
ctx->log(RC_LOG_ERROR, "rcCopyPolyMesh: Out of memory 'dst.flags' (%d).", src.npolys);
|
ctx->log(RC_LOG_ERROR, "rcCopyPolyMesh: Out of memory 'dst.flags' (%d).", src.npolys);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memcpy(dst.flags, src.flags, sizeof(unsigned char)*src.npolys);
|
memcpy(dst.flags, src.flags, sizeof(unsigned short)*src.npolys);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1217,7 @@ bool rcBuildPolyMeshDetail(rcContext* ctx, const rcPolyMesh& mesh, const rcCompa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
dmesh.ntris = 0;
|
dmesh.ntris = 0;
|
||||||
dmesh.tris = (unsigned char*)rcAlloc(sizeof(unsigned char*)*tcap*4, RC_ALLOC_PERM);
|
dmesh.tris = (unsigned char*)rcAlloc(sizeof(unsigned char)*tcap*4, RC_ALLOC_PERM);
|
||||||
if (!dmesh.tris)
|
if (!dmesh.tris)
|
||||||
{
|
{
|
||||||
ctx->log(RC_LOG_ERROR, "rcBuildPolyMeshDetail: Out of memory 'dmesh.tris' (%d).", tcap*4);
|
ctx->log(RC_LOG_ERROR, "rcBuildPolyMeshDetail: Out of memory 'dmesh.tris' (%d).", tcap*4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user