Merge "test_vendor: Use the license template"
diff --git a/bta/pan/bta_pan_ci.cc b/bta/pan/bta_pan_ci.cc
index 82d6593..d2fda39 100644
--- a/bta/pan/bta_pan_ci.cc
+++ b/bta/pan/bta_pan_ci.cc
@@ -183,10 +183,10 @@
  ******************************************************************************/
 BT_HDR* bta_pan_ci_readbuf(uint16_t handle, RawAddress& src, RawAddress& dst,
                            uint16_t* p_protocol, bool* p_ext, bool* p_forward) {
-  tBTA_PAN_SCB* p_scb;
+  tBTA_PAN_SCB* p_scb = bta_pan_scb_by_handle(handle);
   BT_HDR* p_buf;
 
-  p_scb = bta_pan_scb_by_handle(handle);
+  if (p_scb == NULL) return NULL;
 
   p_buf = (BT_HDR*)fixed_queue_try_dequeue(p_scb->data_queue);
   if (p_buf != NULL) {
diff --git a/bta/pan/bta_pan_main.cc b/bta/pan/bta_pan_main.cc
index 17506a2..09df88f 100644
--- a/bta/pan/bta_pan_main.cc
+++ b/bta/pan/bta_pan_main.cc
@@ -51,7 +51,8 @@
   BTA_PAN_CONN_OPEN,
   BTA_PAN_CONN_CLOSE,
   BTA_PAN_FREE_BUF,
-  BTA_PAN_IGNORE
+  BTA_PAN_IGNORE,
+  BTA_PAN_MAX_ACTIONS
 };
 
 /* type for action functions */
@@ -184,11 +185,9 @@
   /* execute action functions */
   for (i = 0; i < BTA_PAN_ACTIONS; i++) {
     action = state_table[event][i];
-    if (action != BTA_PAN_IGNORE) {
-      (*bta_pan_action[action])(p_scb, p_data);
-    } else {
-      break;
-    }
+    CHECK(action < BTA_PAN_MAX_ACTIONS);
+    if (action == BTA_PAN_IGNORE) continue;
+    (*bta_pan_action[action])(p_scb, p_data);
   }
 }
 
diff --git a/btif/src/btif_sock_sdp.cc b/btif/src/btif_sock_sdp.cc
index 0bb09f2..d7993e5 100644
--- a/btif/src/btif_sock_sdp.cc
+++ b/btif/src/btif_sock_sdp.cc
@@ -88,6 +88,8 @@
 
 #define UUID_MAX_LENGTH 16
 
+#define SPP_PROFILE_VERSION 0x0102
+
 // Adds a protocol list and service name (if provided) to an SDP record given by
 // |sdp_handle|, and marks it as browseable. This is a shortcut for defining a
 // set of protocols that includes L2CAP, RFCOMM, and optionally OBEX. If
@@ -356,6 +358,11 @@
   stage = "service_class";
   if (!SDP_AddServiceClassIdList(handle, 1, &service)) goto error;
 
+  stage = "profile_descriptor_list";
+  if (!SDP_AddProfileDescriptorList(handle, UUID_SERVCLASS_SERIAL_PORT,
+                                    SPP_PROFILE_VERSION))
+    goto error;
+
   APPL_TRACE_DEBUG(
       "add_spp_sdp: service registered successfully, "
       "service_name: %s, handle 0x%08x)",
diff --git a/osi/src/config.cc b/osi/src/config.cc
index c5b6b89..9bf76df 100644
--- a/osi/src/config.cc
+++ b/osi/src/config.cc
@@ -211,7 +211,7 @@
   const std::string temp_filename = filename + ".new";
 
   // Extract directory from file path (e.g. /data/misc/bluedroid).
-  const std::string& directoryname = base::FilePath(filename).DirName().value();
+  const std::string directoryname = base::FilePath(filename).DirName().value();
   if (directoryname.empty()) {
     LOG(ERROR) << __func__ << ": error extracting directory from '" << filename
                << "': " << strerror(errno);