diff options
author | Denis Kenzior <denkenz@gmail.com> | 2013-03-26 10:34:09 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2013-03-26 10:34:09 -0500 |
commit | b4518caa50f03b40e9f9434dc17558665bb8ee3f (patch) | |
tree | 4e406faf2dd729039a6a48402b44173c45f7c46a /plugins/sim900.c | |
parent | 2d09257855e186b50f7f0083059df5cd07804ea5 (diff) | |
download | ofono-b4518caa50f03b40e9f9434dc17558665bb8ee3f.tar.bz2 |
sim900: Properly clean up device IOChannel on error
Diffstat (limited to 'plugins/sim900.c')
-rw-r--r-- | plugins/sim900.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/sim900.c b/plugins/sim900.c index de2a6f7a..52fc38de 100644 --- a/plugins/sim900.c +++ b/plugins/sim900.c @@ -139,8 +139,12 @@ static GAtChat *open_device(struct ofono_modem *modem, chat = g_at_chat_new(channel, syntax); g_at_syntax_unref(syntax); - if (chat == NULL) + if (chat == NULL) { + g_io_channel_unref(data->device); + data->device = NULL; + return NULL; + } if (getenv("OFONO_AT_DEBUG")) g_at_chat_set_debug(chat, sim900_debug, debug); |