fixed some memory leaks, still issue with material index allocation leaking 4 bytes (possibly double allocation) (#964)

This commit is contained in:
chriscamacho 2019-09-13 12:29:52 +01:00 committed by Ray
parent e5d5f6e367
commit 6916ff58b1
2 changed files with 60 additions and 58 deletions

View file

@ -2918,6 +2918,7 @@ static Model LoadOBJ(const char *fileName)
tinyobj_attrib_free(&attrib); tinyobj_attrib_free(&attrib);
tinyobj_shapes_free(meshes, meshCount); tinyobj_shapes_free(meshes, meshCount);
tinyobj_materials_free(materials, materialCount); tinyobj_materials_free(materials, materialCount);
RL_FREE(data); // oh ray how did you miss this...! :-p
} }
// NOTE: At this point we have all model data loaded // NOTE: At this point we have all model data loaded

View file

@ -2967,7 +2967,8 @@ char *LoadText(const char *fileName)
Shader LoadShader(const char *vsFileName, const char *fsFileName) Shader LoadShader(const char *vsFileName, const char *fsFileName)
{ {
Shader shader = { 0 }; Shader shader = { 0 };
shader.locs = (int *)RL_CALLOC(MAX_SHADER_LOCATIONS, sizeof(int)); // double allocation causing leak (allocation done in LoadShaderCode)
//shader.locs = (int *)RL_CALLOC(MAX_SHADER_LOCATIONS, sizeof(int));
char *vShaderStr = NULL; char *vShaderStr = NULL;
char *fShaderStr = NULL; char *fShaderStr = NULL;