Fixed free(NULL) (thanks Toon)