In SO2 molecule there are two bond pairs and one lone pair of electron .Due to repulsion by lone pair its bond angle decreases from 120° to 119.5° hence it is not linear whereas in CO2 molecule there is no lone pair of electron due to which it has linear geometry.