[PATCH] Fix GUI crash while connecting Interlink Bluetooth Mouse in android platform.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Crash is due to some junk characters in the device name.
The device name is copied from a string variable after freeing the memory it points to, so there were some junk characters in it which was the reason for the crash.
Fixing the issue by freeing the memory in string variable after device name is copied.

Signed-off-by: Balamurugan Mahalingam <mbalamurugan@xxxxxxxxxxx>
---
 compat/sdp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/compat/sdp.c b/compat/sdp.c
index 8898136..ff2e39f 100644
--- a/compat/sdp.c
+++ b/compat/sdp.c
@@ -152,7 +152,6 @@ int get_stored_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp
 			&vendor, &product, &version, &subclass, &country,
 			&parser, desc, &req->flags, &pos);
 
-	free(str);
 
 	req->vendor   = vendor;
 	req->product  = product;
@@ -163,6 +162,7 @@ int get_stored_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp
 
 	snprintf(req->name, 128, "%s", str + pos);
 
+	free(str);
 	req->rd_size = strlen(desc) / 2;
 	req->rd_data = malloc(req->rd_size);
 	if (!req->rd_data) {
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux