widgets: avoid using dynamic memory allocation for cleanup data