[Bf-committers] Possible bug, uninitialized var in depsgraph.c

Ton Roosendaal ton at blender.org
Wed Jul 13 11:16:27 CEST 2005


Hi,

> 							subtarget= "";
> ...
>
> 							target = get_constraint_target(con, &subtarget);
> // didn't check but i think this sets subtarget to be a valid pointer  
> OR  NULL
> .....
> if(subtarget[0]) <-- MSCV6 build stalls here since subtarget is NULL (  
> trying to READ OUT the first element subtarget points to and reading  
> out a NULL pointer seems illegal to MSVC6 and me )

Hrms... I'm used to have strings initialized that way. For example:

char *str= "blahblah";

should make "str" a pointer to a static array.
Using an empty string "" should give a pointer too, with the first  
element being zero?

Checking on the get_constraint_target() code, it appears to me that an  
initialize should be not needed at all. Just checking for validity of  
the subtarget pointer, and then the first element is fine. Committed!

-Ton-

------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list