<PAGE>

                                  Exhibit 10.22

                            RESTRICTED UNIT AGREEMENT

This Restricted Unit Agreement (the "Agreement"), dated OCTOBER 29, 2003, is by
and between VALERO ENERGY CORPORATION, a Delaware corporation ("Valero"), and
WILLIAM E. GREEHEY, Chief Executive Officer of Valero ("Greehey").

1.       GRANT OF RESTRICTED UNITS. Valero hereby grants to Greehey 275,000
         "Restricted Units" representing the right to receive certain cash
         payments from Valero on the Vesting Dates set forth below. The amount
         of cash payable to Greehey on each Vesting Date will be equal to the
         product of: (a) the number of Restricted Units vesting on that date,
         multiplied by (b) the fair market value on that date of one share of
         Valero common stock, $.01 par value ("Common Stock"). For purposes of
         this Agreement, "fair market value" means the average of the "high" and
         "low" reported sales price per share of Common Stock as reported on the
         New York Stock Exchange as of the relevant measuring date, or if there
         are no sales on the NYSE on that measuring date, then as of the next
         following day on which there were sales.

2.       DIVIDEND RIGHTS. In addition to the right to receive cash on each
         Vesting Date as described in Section 1 above, Greehey will be entitled
         to receive periodic cash payments in relation to dividends that are
         paid on Valero's common stock (the "Dividend Rights"). For purposes of
         the settlement of Greehey's Dividend Rights under this Agreement,
         Greehey will be deemed to be a holder of one share of Valero Common
         Stock for each unvested Restricted Unit held by Greehey. As and when
         dividends are declared on Valero's Common Stock, in settlement of the
         Dividend Rights granted hereunder Greehey will be entitled to receive a
         cash payment equal to the product of: (a) the declared dividend per
         share on Valero's Common Stock, multiplied by (b) the number of
         unvested Restricted Units held by Greehey on the dividend record date.

3.       VESTING. The Restricted Units will vest in the following increments on
         the following dates: 91,667 on OCTOBER 29, 2004; 91,667 on OCTOBER 29,
         2005; and 91,666 on OCTOBER 29, 2006 (each a "Vesting Date").

4.       TERMINATION OF EMPLOYMENT. If Greehey's employment with Valero is
         terminated by Greehey (whether through retirement, death, disability or
         otherwise), or is terminated by Valero without "cause" (as defined per
         the Employment Agreement then in effect between Valero and Greehey, or
         if none, then the Employment Agreement presently in effect on the date
         hereof, as amended) (as applicable, hereafter the "Employment
         Agreement"), then any Restricted Units that have not vested as of the
         date of termination of Greehey's employment shall not be forfeited and
         shall continue to vest in accordance with the vesting schedule set
         forth in Section 3 above. If, however, Greehey's employment is
         terminated by Valero for "cause" (as defined per the Employment
         Agreement), then those Restricted Units that have not yet vested on the
         date of termination of Greehey's employment shall be forfeited as of
         that date and Greehey shall not be entitled to Dividend Rights or any
         other payments with respect thereto.

5.       WITHHOLDING. Valero is hereby authorized to withhold from any
         settlement of the Restricted Units or Dividend Rights the amount of any
         applicable withholding taxes with respect to such settlement, and to
         take any other action necessary to satisfy all obligations for the
         payment of the taxes.



                                     Page 1
<PAGE>


6.       REORGANIZATION EVENT. In the event of any stock dividend, rights
         distribution, split-up, recapitalization, share exchange, merger,
         consolidation, stock acquisition, spin-off, separation, reorganization,
         liquidation or other similar event (any one of which being hereafter
         referred to as a "Reorganization Event"), as a result of which (i)
         shares or other securities of any class or rights shall be issued in
         respect of outstanding shares of Common Stock, or (ii) shares of Common
         Stock shall be changed into the same or a different number of shares of
         the same or another class or classes or other securities, then the
         Restricted Units granted under this Agreement shall be affected as
         follows. Upon the closing of the Reorganization Event, each unvested
         Restricted Unit shall be treated as one share of Common Stock for
         purposes of determining the number of unvested Restricted Units owned
         by Greehey immediately following the Reorganization Event.

7.       CHANGE OF CONTROL. Defined. A "Change of Control" shall be deemed to
         occur when:

         (a)      the stockholders of Valero approve any agreement or
                  transaction pursuant to which: (i) Valero will merge or
                  consolidate with any other entity (other than a wholly owned
                  subsidiary of Valero) and will not be the surviving entity (or
                  in which Valero survives only as the subsidiary of another
                  entity); (ii) Valero will sell all or substantially all of its
                  assets to any other person or entity (other than a wholly
                  owned subsidiary of Valero); or (iii) Valero will be
                  liquidated or dissolved;

         (b)      any "person" or "group" (as these terms are used in Section
                  13(d) and 14(d) of the Securities Exchange Act of 1934) other
                  than Valero, any subsidiary of Valero, any employee benefit
                  plan of Valero or its subsidiaries, or any entity holding
                  shares of Common Stock for or pursuant to the terms of such
                  employee benefit plans, is or becomes an "Acquiring Person" as
                  defined in the Rights Agreement dated June 18, 1997 between
                  Valero and Computershare Investor Services, L.L.C., as
                  successor Rights Agent to Harris Trust and Savings Bank, as
                  amended (or any successor Rights Agreement), or, if no Rights
                  Agreement is then in effect, such person or group acquires or
                  holds such number of shares as, under the terms and conditions
                  of the most recent such Rights Agreement to be in force and
                  effect, would have caused such person or group to be an
                  "Acquiring Person" thereunder;

         (c)      any "person" or "group" shall commence a tender offer or
                  exchange offer for 15% or more of the shares of Common Stock
                  then outstanding, or for any number or amount of shares of
                  Common Stock which, if the tender or exchange offer were to be
                  fully subscribed and all shares of Common Stock for which the
                  tender or exchange offer is made were to be purchased or
                  exchanged pursuant to the offer, would result in the acquiring
                  person or group directly or indirectly beneficially owning 50%
                  or more of the shares of Common Stock then outstanding;

         (d)      individuals who, as of any date, constitute Valero's Board of
                  Directors (the "Incumbent Board") thereafter cease for any
                  reason to constitute at least a majority of the Board of
                  Directors; provided, however, that any individual becoming a
                  director whose election, or nomination for election by
                  Valero's stockholders, was approved by a vote of at least a
                  majority of the directors then comprising the Incumbent Board
                  shall be considered as though such individual were a member of
                  the Incumbent Board, but excluding, for this purpose, any such
                  individual whose initial assumption of office occurs as a
                  result of an actual or threatened election contest with
                  respect to the election or removal of directors or other
                  actual or threatened solicitation of proxies or consents by or
                  on behalf of a person or group other than the Board of
                  Directors;



                                     Page 2
<PAGE>


         (e)      the occurrence of the Distribution Date (as defined in the
                  Rights Agreement dated June 18, 1997 between Valero and
                  Computershare Investor Services, L.L.C., as successor Rights
                  Agent to Harris Trust and Savings Bank, as amended); or

         (f)      any other event determined by Valero's Board of Directors or
                  the Compensation Committee thereof to constitute a "Change of
                  Control" hereunder.

8.       ACTIONS OF COMPENSATION COMMITTEE. The Compensation Committee, as
         constituted before a Change of Control, is hereby authorized, and has
         sole discretion to take any one or more of the following actions,
         whether in connection with a Change of Control or otherwise:

         (a)      provide for the acceleration of any vesting periods relating
                  to the Restricted Units to a date or dates determined by the
                  Compensation Committee;

         (b)      adjust any unvested Restricted Units as the Compensation
                  Committee deems appropriate to reflect a Change of Control; or

         (c)      cause any unvested Restricted Units to be assumed, or new
                  rights substituted therefor, by the acquiring or surviving
                  corporation after a Change of Control. The Compensation
                  Committee may in its discretion include other provisions and
                  limitations in any amended Restricted Unit Agreement as it may
                  deem equitable and in the best interests of Valero.

9.       RIGHTS AS STOCKHOLDER. Except for the Dividend Rights described above,
         neither Greehey nor any person claiming by, through or under Greehey
         with respect to the Restricted Units shall have any rights as a
         stockholder of Valero (including, without limitation, voting rights).

10.      ASSIGNMENT.

         (a)      This Agreement and Greehey's interest in the Restricted Units
                  and Dividend Rights granted by this Agreement are of a
                  personal nature, and, except as expressly provided below,
                  Greehey's rights with respect thereto may not be sold,
                  mortgaged, pledged, assigned, transferred, conveyed or
                  disposed of in any manner by Greehey. Any such attempted sale,
                  mortgage, pledge, assignment, transfer, conveyance or
                  disposition shall be void, and Valero shall not be bound
                  thereby.

         (b)      Cash payments upon settlement of the Restricted Units and
                  Dividend Rights may be made only to Greehey, during his
                  lifetime, or to his beneficiary(ies) after his death. After
                  Greehey's death, any cash settlements with respect to
                  Restricted Units or Dividend Rights will be made to Greehey's
                  beneficiary(ies) as designated under Greehey's Valero Energy
                  Corporation Beneficiary Designation Form, or if there is no
                  such designation, to the beneficiary(ies) designated in
                  Greehey's last will and testament.

11.      SUCCESSORS. This Agreement shall be binding upon any successors of
         Valero and upon the beneficiaries, legatees, heirs, administrators,
         executors and legal representatives of Greehey.

12.      NO TRUST FUND. This Agreement shall not create or be construed to
         create a trust or separate fund of any kind or any fiduciary
         relationship between Valero and Greehey or any other person with
         respect to the Restricted Units and Dividend Rights. To the extent that
         any person acquires a right to receive payments from Valero under this
         Agreement, such right shall be no greater than the right of any
         unsecured general creditor of Valero.



                                     Page 3
<PAGE>


13.      GOVERNING LAW. The validity, construction, and effect of this Agreement
         shall be determined in accordance with the laws of the State of Texas.


                                           VALERO ENERGY CORPORATION

                                           By:  /s/ Keith D. Booke
                                                --------------------------------
                                                Keith D. Booke
                                                Executive Vice President and
                                                Chief Administrative Officer

                                              /s/ William E. Greehey
                                           -------------------------------------
                                           WILLIAM E. GREEHEY



                                     Page 4