Skip to content

Commit

Permalink
Fix use after move in ClientInterceptor and ServiceInterceptor
Browse files Browse the repository at this point in the history
Summary: Self-explanatory. This doesn't currently cause a problem because moving a pointer is equivalent to a copy.

Reviewed By: vitaut

Differential Revision: D62557159

fbshipit-source-id: a3153ffcf6424fe73f5ca9e72ed316431f911c2b
  • Loading branch information
praihan authored and facebook-github-bot committed Sep 12, 2024
1 parent b4096a2 commit a536e54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class ClientInterceptor : public ClientInterceptorBase {

private:
void internal_onRequest(RequestInfo requestInfo) final {
auto* storage = requestInfo.storage;
if (auto value = onRequest(std::move(requestInfo))) {
requestInfo.storage->emplace<RequestState>(std::move(*value));
storage->emplace<RequestState>(std::move(*value));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ class ServiceInterceptor : public ServiceInterceptorBase {
ConnectionInfo connectionInfo, RequestInfo requestInfo) final {
auto* connectionState =
getValueAsType<ConnectionState>(*connectionInfo.storage);
auto* storage = requestInfo.storage;
if (auto value =
co_await onRequest(connectionState, std::move(requestInfo))) {
requestInfo.storage->emplace<RequestState>(std::move(*value));
storage->emplace<RequestState>(std::move(*value));
}
}

Expand Down

0 comments on commit a536e54

Please sign in to comment.