Fix undefined reference variable when unallocating

The id variable was undefined in this context, we need to use
source.data('id').

(cherry picked from commit f38b53c8a8b60e0adb210b5a0afadb1ff22f171d)