A substance which gives a brick red flame and breaks down on heating giving oxygen and brown gas is:
Calcium nitrate
Since the magnesium or its compound does not give flame test, it must be a compound of calcium. Also the gas evolved is brown coloured shows that it is the oxide of nitrogen. All these inference indicates towards the compound calcium nitrate.