It is made when potassium nitrate is reacted with hydrochloric acid , making nitric acid and potassium chloride . It is a by-product of the making of nitric acid from potassium nitrate and hydrochloric acid .