Coronal heating due to the emergence of magnetic flux