Fix diag_hex modulo zaniness
Clean up some test memory leaks