Anas bin Maalik (Radiyallahu anhu) says: “Dates were presented to Rasulullah (Sallallahu ‘Alayhi Wasallam). I saw him eating them. Due to hunger he was sitting on the support of something and not on his own support”.
That means he was supporting his back on a wall or something. It has been prohibited in the Ahaadith to lean on something and eat. Here it was due to weakness, therefore it cannot be said that it is contrary to the ahaadith prohibiting it, nor can it be reasoned from this hadeeth that it is permissible to lean and eat.