POV-Ray : Newsgroups : povray.programming : Parsing an object : Re: Parsing an object Server Time
28 Jul 2024 12:23:46 EDT (-0400)
  Re: Parsing an object  
From: Warp
Date: 17 Jan 2001 10:30:28
Message: <3a65ba93@news.povray.org>
I have run into one problem. I get a:

error: Attempt to malloc zero size block (File: parse.c Line: 4385).

  This line is inside the Parse_Mesh() function and is the following:

  Object->Data->UVCoords = (UV_VECT *)POV_MALLOC(number_of_uvcoords*sizeof(UV_VECT),
"triangle mesh data");

  It unconditionally allocates space for uv-coordinates even if
number_of_uvcoords is 0 (as it is in my case where I only create triangles
with the tesselation function).

  Shouldn't it be enclosed in an if(number_of_uvcoords)?
  Will I break something if I add that condition?

  Why it doesn't crash with regular meshes (without uv-coordinates)?

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.