If agent is not set to NULL after it's freed, the following situation
would not work:

smart_messaging_register_agent()
smart_messaging_unregister_agent()
smart_messaging_register_agent()

And this one could potentially crash oFono:

smart_messaging_register_agent()
smart_messaging_unregister_agent()
smart_messaging_unregister_agent()
---
 plugins/smart-messaging.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index 40af89f..52344de 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -165,6 +165,7 @@ static DBusMessage 
*smart_messaging_unregister_agent(DBusConnection *conn,
                return __ofono_error_failed(msg);
 
        sms_agent_free(sm->agent);
+       sm->agent = NULL;
 
        return dbus_message_new_method_return(msg);
 }
-- 
1.7.4

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to