sixaxis: Throw an error when cable setup fails
authorBastien Nocera <hadess@hadess.net>
Fri, 7 Jun 2019 06:54:11 +0000 (08:54 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
If btd_request_authorization_cable_configured() fails, throw an error
and free resources.

Change-Id: Ibd9a8ca9e920bac1f23f3808f8b99ab3f2bd99d2
Signed-off-by: himanshu <h.himanshu@samsung.com>
plugins/sixaxis.c

index 591eea2..3e14332 100755 (executable)
@@ -383,6 +383,12 @@ static bool setup_device(int fd, const char *sysfs_path,
                                        adapter_bdaddr, &device_bdaddr,
                                        HID_UUID, agent_auth_cb, closure);
 
+       if (closure->auth_id == 0) {
+               error("sixaxis: could not request cable authorization");
+               auth_closure_destroy(closure, true);
+               return false;
+       }
+
        g_hash_table_insert(pending_auths, closure->sysfs_path, closure);
 
        return true;