hfp_hf_bluez5: Fix missing fd close

This patch fix an unusual scenario, service_level_connection() fails if
GIOChannel or GAtChat memory allocation fails.
This commit is contained in:
Claudio Takahasi 2013-01-29 17:38:40 -03:00 committed by Denis Kenzior
parent b6f92d3074
commit 9496fe8e70
1 changed files with 3 additions and 1 deletions

View File

@ -323,10 +323,12 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
}
err = service_level_connection(modem, fd, HFP_VERSION_LATEST);
if (err < 0 && err != -EINPROGRESS)
if (err < 0 && err != -EINPROGRESS) {
close(fd);
return g_dbus_create_error(msg, BLUEZ_ERROR_INTERFACE
".Rejected",
"Not enough resources");
}
hfp = ofono_modem_get_data(modem);
hfp->msg = dbus_message_ref(msg);