This passage was a bit troubling upon first read. I came to 2 Samuel 1:14 that stated David killed the young Amalekite that brought news that he killed Saul (per Saul’s request) and David, who was grieved, killed him. I struggled to find many sources that have a good explanation.
This site has a list of them, but I don’t find too many particularly helpful: http://biblehub.com/commentaries/2_samuel/1-15.htm
My thoughts on this are that the boy admitted treason by killing him. David did not always make the best “godly” decisions throughout his life. He also wanted to show publicly that he was grieved and not responsible for sending the boy to kill his king. The other possible reason is that Saul was appointed by God, and no one has authority to kill him except God.
The boy was likely lying as pointed out by this site: https://hermeneutics.stackexchange.com/questions/1837/who-killed-saul so he was admitting treason on a lie hoping to gain favor.