Fix strdup/malloc/free ordering to always free the right pointer.

This commit ensures that udp_send_msg is freed before being reallocated
and freed before the process exits. This also changes the last fprintf
to a log_warn() call, which should be more inline with the intent.