Clean up send_ping* code
realloc failure should set errno: print errno msg
More cleanup and reformatting of code