unchecked malloc result fixed