Diff between a5583ffc450aec1d988ccfcbe0690a7b37f17817 and 6ca8be71f52257f01c3a26e5219321ba522568c4

Changed Files

File Additions Deletions Status
src/device.c +5 -14 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index 3ef0340..85a6aa6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5545,22 +5545,13 @@ static sdp_list_t *read_device_records(struct btd_device *device)
 const sdp_record_t *btd_device_get_record(struct btd_device *device,
 							const char *uuid)
 {
-	if (device->tmp_records) {
-		const sdp_record_t *record;
-
-		record = find_record_in_list(device->tmp_records, uuid);
-		if (record != NULL)
-			return record;
-
-		sdp_list_free(device->tmp_records,
-					(sdp_free_func_t) sdp_record_free);
-		device->tmp_records = NULL;
+	/* Load records from storage if there is nothing in cache */
+	if (!device->tmp_records) {
+		device->tmp_records = read_device_records(device);
+		if (!device->tmp_records)
+			return NULL;
 	}
 
-	device->tmp_records = read_device_records(device);
-	if (!device->tmp_records)
-		return NULL;
-
 	return find_record_in_list(device->tmp_records, uuid);
 }