Both are correct. Half can be a predeterminer as well as an adjective. The only difference is that half gallon is used as an adjective as well as a noun.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.