aboutsummaryrefslogtreecommitdiff
path: root/src/obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/obj.c')
-rw-r--r--src/obj.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/obj.c b/src/obj.c
index 5554b46..d832604 100644
--- a/src/obj.c
+++ b/src/obj.c
@@ -398,8 +398,10 @@ appendMtl(char *line, Material **mtl, int index)
if (index == 0)
*mtl = (Material *)calloc(1, sizeof(Material));
- else
+ else {
*mtl = (Material *)realloc(*mtl, (index + 1) * sizeof(Material));
+ memset(*mtl + index, 0, sizeof(Material));
+ }
sscanf(line, "%s", name);
strncpy((*mtl + index)->name, name, OBJ_LINE_MAX);
Feel free to download, copy and edit any repo