[PATCH] smart-messaging: set agent to NULL after free