tgt is not set to NULL if slen == 0.  I'm not sure it ever could cause any problems - possibly in very weird circumstances.