POV-Ray : Newsgroups : povray.programming : Parsing an object : Re: Parsing an object Server Time
28 Jul 2024 18:12:20 EDT (-0400)
  Re: Parsing an object  
From: Wlodzimierz ABX Skiba
Date: 17 Jan 2001 11:41:54
Message: <3a65cb52$1@news.povray.org>
Warp wrote in 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).
>
>  Shouldn't it be enclosed in an if(number_of_uvcoords)?
>  Will I break something if I add that condition?


probaly you should write something like

if (number_of_uvcoords>0)
{
  Object->Data->UVCoords = (UV_VECT
*)POV_MALLOC(number_of_uvcoords*sizeof(UV_VECT), "triangle mesh data");
}
else
{
Object->Data->UVCoords = NULL;
}

and check all places where Object->Data->UVCoords is used
to avoid refferencing arrays at NULL pointer
for example at POV_FREE for this pointer

ABX


Post a reply to this message

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