Skip to content

Commit

Permalink
fix(kafka cpp): do not free NUL stable_ptr (#1747)
Browse files Browse the repository at this point in the history
  • Loading branch information
4eUeP authored Jan 23, 2024
1 parent d83cab5 commit bcbee61
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hstream-kafka/cbits/hs_kafka_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ class ServerHandler : public HandlerAdapter<std::unique_ptr<folly::IOBuf>> {
HsStablePtr sp_;

void onClientExit() {
hs_free_stable_ptr(sp_);
// Make sure the haskell land does not use the freed stable pointer
sp_ = nullptr;
// FIXME: lock guard here?
if (sp_ != nullptr) {
hs_free_stable_ptr(sp_);
// Make sure the haskell land does not use the freed stable pointer
sp_ = nullptr;
}
}
};

Expand Down

0 comments on commit bcbee61

Please sign in to comment.