api06: Use 2-byte ints and check malloc return value.