Skip to content

Fix sampling of vector_t quantities#530

Closed
lisataldir wants to merge 0 commit intoCFD-GO:developfrom
lisataldir:feature/handlers
Closed

Fix sampling of vector_t quantities#530
lisataldir wants to merge 0 commit intoCFD-GO:developfrom
lisataldir:feature/handlers

Conversation

@lisataldir
Copy link

I fixed a segmentation fault that appears in the function writeHistory of the Sample.cpp file when using the handler with vector_t quantities

src/Sampler.cpp Outdated
for (const auto& quantity : model->quantities) {
if (quant->in(quantity.name)) {
if (quantity.isVector) {
real_t *tmp = (real_t *)malloc(3*sizeof(real_t));
Copy link
Member

Choose a reason for hiding this comment

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

Please change this to a static array real_t tmp[3]. It doesn't make sense to dynamically allocate such a small thing of constant size.

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