Skip to content

use allocator for split function - #29

Merged
wjwwood merged 2 commits into
masterfrom
split_allocator
Jun 14, 2017
Merged

wjwwood merged 2 commits into
masterfrom
split_allocator

Conversation

@Karsten1987

Copy link
Copy Markdown
Contributor

connects to #6

@Karsten1987 Karsten1987 added the in review Waiting for review (Kanban column) label Jun 7, 2017
@Karsten1987 Karsten1987 self-assigned this Jun 7, 2017

@wjwwood wjwwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue I have with this pull request, is that the rcutils_string_array_fini() function uses free() no matter what. So if you use something other than the default allocator here, and do not clear the string array yourself, then you can get in a situation where you're calling free() on memory where malloc() was never called.

That being said, this is an incremental improvement, it is possible to do it correctly as-is, and in our common case right now it will just work since we always use the default allocator.

Separately the string array should either be setup with an allocator or it's fini function should not free the strings themselves.

@Karsten1987

Karsten1987 commented Jun 14, 2017 via email

Copy link
Copy Markdown
Contributor Author

@wjwwood

wjwwood commented Jun 14, 2017

Copy link
Copy Markdown
Member

This also cannot be merged due to conflicts. @Karsten1987 you need to pull before you do stuff lol.

@wjwwood

wjwwood commented Jun 14, 2017

Copy link
Copy Markdown
Member

@Karsten1987 nvm, that's my bad, GitHub's rendering was wrong somehow.

@wjwwood
wjwwood merged commit e2c9582 into master Jun 14, 2017
@wjwwood
wjwwood deleted the split_allocator branch June 14, 2017 18:12
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Jun 14, 2017
yashi pushed a commit to yashi/rcutils that referenced this pull request Jul 23, 2023
(cherry picked from commit 55de2e1)

Co-authored-by: Błażej Sowa <[email protected]>
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