These two (that is, Sayyiduna Abu Hurayrah (may Allah be pleased with him) and Sayyiduna Abu Dharr al-Ghifari (may Allah be pleased with him)) narrate that the Prophet (peace and blessings be upon him) said: "When death comes to a student of knowledge and he dies in this state (that is, while acquiring knowledge), he will be counted a martyr."
Al-Bazzar recorded it; its chain contains a narrator, Hilal bin Abd al-Rahman al-Hanafi, and he is matruk (abandoned).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب العلم / 508