Abdullah bin Abi Qatadah (may Allah have mercy on him) narrates from his father, Sayyiduna Abu Qatadah (may Allah be pleased with him), that a man came to the Messenger of Allah (peace and blessings be upon him) and said: "O Messenger of Allah (peace and blessings be upon him)! If I am killed as a martyr in the path of Allah, will my sins be forgiven?" The Messenger of Allah (peace and blessings be upon him) said: "If you are patient in the path of Allah, seeking reward, advancing to fight and not fleeing the field, and then you are martyred, Allah will forgive your sins." When he sat down, he (peace and blessings be upon him) asked: "What did you say?" He repeated it, and he (peace and blessings be upon him) said: "Except debt, for Jibril (peace be upon him) has just informed me of this."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب البيوع / 10962