Fix compiler warnings for signed/unsigned comparison and void * arithmetic issues
Fix attempt to free uninitialized pointers when building with SG support