Gallardo outlasts Lincecum, Brewers top Giants 7-4