Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[foxy] Avoid memory leaks and undefined behavior in rmw_fastrtps_dynamic_cpp typesupport code (#429) #577

Merged
merged 1 commit into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ struct StringHelper<rosidl_typesupport_introspection_c__MessageMembers>
return std::string(data.data);
}

static void assign(eprosima::fastcdr::Cdr & deser, void * field, bool)
static void assign(eprosima::fastcdr::Cdr & deser, void * field)
{
std::string str;
deser >> str;
Expand All @@ -120,12 +120,9 @@ struct StringHelper<rosidl_typesupport_introspection_cpp::MessageMembers>
return *(static_cast<std::string *>(data));
}

static void assign(eprosima::fastcdr::Cdr & deser, void * field, bool call_new)
static void assign(eprosima::fastcdr::Cdr & deser, void * field)
{
std::string & str = *(std::string *)field;
if (call_new) {
new(&str) std::string;
}
deser >> str;
}
};
Expand Down Expand Up @@ -195,8 +192,7 @@ class TypeSupport : public BaseTypeSupport
bool deserializeROSmessage(
eprosima::fastcdr::Cdr & deser,
const MembersType * members,
void * ros_message,
bool call_new) const;
void * ros_message) const;
};

} // namespace rmw_fastrtps_dynamic_cpp
Expand Down
Loading