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

Double free() of NodePopulationProperties #352

Closed
a-vartenkov opened this issue Mar 18, 2024 · 2 comments
Closed

Double free() of NodePopulationProperties #352

a-vartenkov opened this issue Mar 18, 2024 · 2 comments

Comments

@a-vartenkov
Copy link

The following code:

#include <bbp/sonata/config.h>
int main()
{

    auto config = bbp::sonata::CircuitConfig::fromFile("network/network_config.json");
    auto list_nodes = config.listNodePopulations();
    for (auto &population_name : list_nodes)
    {
        auto snt_population = config.getNodePopulation(population_name); // Error here!
        std::cout << snt_population.size() << std::endl;
    }
}

used with files
network.zip

gives an error "free(): invalid pointer" for ~NodePopulationProperties()
Compiler: g++ 12.3.0

@mgeplf
Copy link
Contributor

mgeplf commented Mar 19, 2024

Thanks for the report; I'm having issues getting the reproduction to work:

clang++-17  -I/home/gevaert/src/libsonata/include -I/home/gevaert/src/libsonata/extlib/HighFive/include -I/usr/include/hdf5/serial -I/home/gevaert/src/libsonata/extlib/Catch2/single_include -std=gnu++14 -L`pwd`/build/  -lsonata -o double-free double-free.cpp 

And using valgrind:

(venv) gevaert@work ~/src/libsonata (master u=)$ LD_PRELOAD=`pwd`/build/libsonata.so valgrind --leak-check=full ./double-free                                                                                                                                                                                                                                          127
==29591== Memcheck, a memory error detector
==29591== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29591== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==29591== Command: ./double-free
==29591==
1
==29591==
==29591== HEAP SUMMARY:
==29591==     in use at exit: 1,864 bytes in 3 blocks
==29591==   total heap usage: 4,033 allocs, 4,030 frees, 1,004,525 bytes allocated
==29591==
==29591== LEAK SUMMARY:
==29591==    definitely lost: 0 bytes in 0 blocks
==29591==    indirectly lost: 0 bytes in 0 blocks
==29591==      possibly lost: 0 bytes in 0 blocks
==29591==    still reachable: 1,864 bytes in 3 blocks
==29591==         suppressed: 0 bytes in 0 blocks
==29591== Reachable blocks (those to which a pointer was found) are not shown.
==29591== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==29591==
==29591== For lists of detected and suppressed errors, rerun with: -s
==29591== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Could you include the full g++ command you're using to build? Are you building the library with the same version of gcc?

@mgeplf
Copy link
Contributor

mgeplf commented May 21, 2024

I'm going to close this, as I can't replicate and there isn't a follow up.

@mgeplf mgeplf closed this as completed May 21, 2024
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

No branches or pull requests

2 participants