  Magnetic helicity is an important concept in solar physics, with a number of
theoretical statements pointing out the important role of magnetic helicity in
solar flares and coronal mass ejections (CMEs). Here we construct a sample of
47 solar flares, which contains 18 no-CME-associated confined flares and 29
CME-associated eruptive flares. We calculate the change ratios of magnetic
helicity and magnetic free energy before and after these 47 flares. Our
calculations show that the change ratios of magnetic helicity and magnetic free
energy show distinct different distributions in confined flares and eruptive
flares. The median value of the change ratios of magnetic helicity in confined
flares is $-0.8$%, while this number is $-14.5$% for eruptive flares. For the
magnetic free energy, the median value of the change ratios is $-4.3$% for
confined flares, whereas this number is $-14.6$% for eruptive flares. This
statistical result, using observational data, is well consistent with the
theoretical understandings that magnetic helicity is approximately conserved in
the magnetic reconnection, as shown by confined flares, and the CMEs take away
magnetic helicity from the corona, as shown by eruptive flares.
