Index: chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
index c983544b2bf73944862d081bf0809efc69eb54c8..9517bc6528e169b30e71c3967273ab4234509e44 100644 |
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc |
@@ -393,7 +393,9 @@ void BluetoothReadFunction::Work() { |
if (total_bytes_read > 0) { |
success_ = true; |
- SetResult(base::BinaryValue::Create(all_bytes, total_bytes_read)); |
+ SetResult(base::BinaryValue::CreateWithCopiedBuffer(all_bytes, |
+ total_bytes_read)); |
+ free(all_bytes); |
} else { |
success_ = (errsv == EAGAIN || errsv == EWOULDBLOCK); |
free(all_bytes); |