Skip to content

Commit

Permalink
fix new/delete mismatch
Browse files Browse the repository at this point in the history
Memory allocated with new must be freed with delete, not free.
  • Loading branch information
martins-mozeiko authored and Minggang Wang committed Jul 17, 2018
1 parent 7f6de3f commit 7549cfe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void Executor::Stop() {
// Important Notice:
// This might be called after Executor::~Executor()
// Don't free Executor::async_ in Executor's dtor
free(async);
delete async;
handle_closed = true;
});
while (!handle_closed)
Expand Down
3 changes: 1 addition & 2 deletions src/rcl_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,7 @@ const rmw_qos_profile_t* GetQosProfileFromObject(v8::Local<v8::Object> object) {
}

rmw_qos_profile_t* GetQoSProfile(v8::Local<v8::Value> qos) {
rmw_qos_profile_t* qos_profile =
reinterpret_cast<rmw_qos_profile_t*>(malloc(sizeof(rmw_qos_profile_t)));
rmw_qos_profile_t* qos_profile = new rmw_qos_profile_t();

if (qos->IsString()) {
*qos_profile = *GetQoSProfileFromString(
Expand Down

0 comments on commit 7549cfe

Please sign in to comment.