Commit 816e6959 authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

Fix memory leak in extensions::api::SerialGetDevicesFunction

This change resets the SerialDeviceEnumeratorPtr held by this class
after enumeration is complete. This breaks the reference cycle between
these two objects, allowing them both to be freed.

Bug: 898177
Change-Id: I874c62f89f8bb59a2c41f8c40afd537404f4580b
Reviewed-on: https://chromium-review.googlesource.com/c/1311533Reviewed-by: default avatarKen Rockot <rockot@google.com>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604415}
parent ebe7202e
...@@ -102,6 +102,7 @@ void SerialGetDevicesFunction::OnGotDevices( ...@@ -102,6 +102,7 @@ void SerialGetDevicesFunction::OnGotDevices(
serial::GetDevices::Results::Create( serial::GetDevices::Results::Create(
mojo::ConvertTo<std::vector<serial::DeviceInfo>>(devices)); mojo::ConvertTo<std::vector<serial::DeviceInfo>>(devices));
Respond(ArgumentList(std::move(results))); Respond(ArgumentList(std::move(results)));
enumerator_.reset();
} }
SerialConnectFunction::SerialConnectFunction() {} SerialConnectFunction::SerialConnectFunction() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment