sim900: Properly clean up device IOChannel on error

This commit is contained in:
Denis Kenzior 2013-03-26 10:34:09 -05:00
parent 2d09257855
commit b4518caa50
1 changed files with 5 additions and 1 deletions

View File

@ -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);