Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix alloc-dealloc-mismatch for _storage.str.data #518

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

Merged

Conversation

alsora
Copy link
Contributor

@alsora alsora commented Mar 10, 2023

The variable _storage.str.data is a char* allocated as

_storage.str.data = new char[size + 1];

This means that we should use delete[] to deallocate it, to avoid undefined behavior.

@alsora
Copy link
Contributor Author

alsora commented Mar 10, 2023

One of the jobs failed with the following error which seems unrelated

  Errors     << behaviortree_cpp:make /root/target_ws/logs/behaviortree_cpp/test.make.000.log
  /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libgtest.a(gtest-all.cc.o): undefined reference to symbol 'pthread_getspecific@@GLIBC_2.2.5'
  /usr/bin/ld: /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status
  make[3]: *** [tests/CMakeFiles/behaviortree_cpp_test.dir/build.make:350: /root/target_ws/devel/.private/behaviortree_cpp/lib/behaviortree_cpp/behaviortree_cpp_test] Error 1
  make[2]: *** [CMakeFiles/Makefile2:742: tests/CMakeFiles/behaviortree_cpp_test.dir/all] Error 2
  make[1]: *** [CMakeFiles/Makefile2:476: CMakeFiles/run_tests.dir/rule] Error 2
  make: *** [Makefile:253: run_tests] Error 2
  cd /root/target_ws/build/behaviortree_cpp; catkin test --get-env behaviortree_cpp | catkin env -si  /usr/bin/make run_tests; cd -

@facontidavide facontidavide merged commit 19f3130 into BehaviorTree:master Mar 10, 2023
@facontidavide
Copy link
Collaborator

thanks

@alsora alsora deleted the asoragna/fix-alloc-dealloc-mismatch branch March 10, 2023 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants