We analyze theoretically a common experimental process used to obtain the magnetic contribution to the specific heat of a given magnetic material. In the procedure, the specific heat of a non-magnetic analog is measured and used to subtract the non-magnetic contributions, which are generally dominated by the lattice degrees of freedom in a wide range of temperatures. We calculate the lattice contribution to the specific heat for the magnetic compounds GdMIn 5 (M = Co, Rh) and for the non-magnetic YMIn 5 and LaMIn 5 (M = Co, Rh), using density functional theory based methods. We find that the best non-magnetic analog for the subtraction depends on the magnetic material and on the range of temperatures. While the phonon specific heat contribution of YRhIn 5 is an excellent approximation to the one of GdCoIn 5 in the full temperature range, for GdRhIn 5 we find a better agreement with LaCoIn 5 , in both cases, as a result of an optimum compensation effect between masses and volumes. We present measurements of the specific heat of the compounds GdMIn 5 (M = Co, Rh) up to room temperature where it surpasses the value expected from the DulongPetit law. We obtain a good agreement between theory and experiment when we include anharmonic effects in the calculations.