Misc cleanup from Sean review. Check that asprintf allocation doesn't fail.