summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2013-01-29 17:38:40 -0300
committerDenis Kenzior <denkenz@gmail.com>2013-01-29 15:58:39 -0600
commit9496fe8e7087d4f6ee3fdda6e58a90f6fa339f86 (patch)
treef8b4133045b9218d3b166c3cba3f64ef11cef638
parentb6f92d3074e4b030e9f95c399b1af50e881448f5 (diff)
downloadofono-9496fe8e7087d4f6ee3fdda6e58a90f6fa339f86.tar.bz2
hfp_hf_bluez5: Fix missing fd close
This patch fix an unusual scenario, service_level_connection() fails if GIOChannel or GAtChat memory allocation fails.
-rw-r--r--plugins/hfp_hf_bluez5.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index c4a3f32f..2aabdd2e 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -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);