Hugh McMaster : reg: Use a helper function to allocate memory and die on failure.