From 804f58c0de0f58760e16f0b29fc7d245aa7a16f3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 19 Jun 2014 15:13:15 +1000 Subject: Curve: zero memory on access rather then calloc also remove redundant check --- source/blender/blenkernel/intern/curve.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/curve.c') diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 8bc22b590b6..0abe956b599 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1085,12 +1085,6 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, sum = (float *)MEM_callocN(sizeof(float) * len, "makeNurbfaces1"); - len = totu * totv; - if (len == 0) { - MEM_freeN(sum); - return; - } - bp = nu->bp; i = nu->pntsu * nu->pntsv; ratcomp = 0; @@ -1193,6 +1187,8 @@ void BKE_nurb_makeFaces(Nurb *nu, float *coord_array, int rowstride, int resolu, } } + zero_v3(in); + /* one! (1.0) real point now */ fp = sum; for (j = jsta; j <= jen; j++) { @@ -1307,6 +1303,8 @@ void BKE_nurb_makeCurve(Nurb *nu, float *coord_array, float *tilt_array, float * } } + zero_v3(coord_fp); + /* one! (1.0) real point */ fp = sum; bp = nu->bp + istart - 1; @@ -1473,7 +1471,7 @@ float *BKE_curve_surf_make_orco(Object *ob) } else { int size = (nu->pntsu * resolu) * (nu->pntsv * resolv) * 3 * sizeof(float); - float *_tdata = MEM_callocN(size, "temp data"); + float *_tdata = MEM_mallocN(size, "temp data"); float *tdata = _tdata; BKE_nurb_makeFaces(nu, tdata, 0, resolu, resolv); -- cgit v1.2.3