Skip to content

Commit

Permalink
Fix data_cdr memory leak
Browse files Browse the repository at this point in the history
Signed-off-by: Eugenio Collado <eugeniocollado@eprosima.com>
  • Loading branch information
EugenioCollado committed Dec 30, 2024
1 parent 7b12ed7 commit 85807da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ddsrecorder_participants/src/cpp/recorder/sql/SqlWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ void SqlWriter::write_nts_(

// Bind the sample data
std::string data_json = "";
std::byte* data_cdr = new std::byte{0};
// Empty data_cdr aux to avoid binding nullptr
std::byte data_cdr_aux = std::byte(0);
std::byte* data_cdr = &data_cdr_aux;
std::uint32_t data_cdr_size = 0;

if (data_format_ == DataFormat::both || data_format_ == DataFormat::json)
Expand Down

0 comments on commit 85807da

Please sign in to comment.