Yeah, so static local variables are dangerous with multiple threads. (This has apparently been in since revision 0, so we should probably look out for other similar assumptions in the code. sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 29 May 2019 09:59:00 +0200
branchsync
changeset 376255501092d6e3
parent 3757 bf2916b900bf
child 3763 2098edd0c4d7
Yeah, so static local variables are dangerous with multiple threads. (This has apparently been in since revision 0, so we should probably look out for other similar assumptions in the code.
src/pEpEngine.c
test/src/engine_tests/URIAddressTests.cc
     1.1 --- a/src/pEpEngine.c	Tue May 28 17:58:34 2019 +0200
     1.2 +++ b/src/pEpEngine.c	Wed May 29 09:59:00 2019 +0200
     1.3 @@ -2403,7 +2403,7 @@
     1.4      )
     1.5  {
     1.6      PEP_STATUS status = PEP_STATUS_OK;
     1.7 -    static pEp_identity *_identity;
     1.8 +    pEp_identity *_identity = NULL;
     1.9  
    1.10      assert(session);
    1.11      assert(address);
    1.12 @@ -2614,7 +2614,7 @@
    1.13      )
    1.14  {
    1.15      PEP_STATUS status = PEP_STATUS_OK;
    1.16 -    static pEp_identity *_identity;
    1.17 +    pEp_identity *_identity = NULL;
    1.18  
    1.19      assert(session);
    1.20      assert(address);
    1.21 @@ -5084,4 +5084,3 @@
    1.22  #endif
    1.23      log_service(session, "### service error log ###", entity, buffer, where);
    1.24  }
    1.25 -
     2.1 --- a/test/src/engine_tests/URIAddressTests.cc	Tue May 28 17:58:34 2019 +0200
     2.2 +++ b/test/src/engine_tests/URIAddressTests.cc	Wed May 29 09:59:00 2019 +0200
     2.3 @@ -40,7 +40,9 @@
     2.4      status = export_key(session, me->fpr, 
     2.5                          &keydata, &keysize);
     2.6  
     2.7 -    cout << keydata << endl;
     2.8 +    TEST_ASSERT(keydata && keysize > 0);
     2.9 +    // no guarantee of NUL-termination atm.
    2.10 +//    cout << keydata << endl;
    2.11  
    2.12      free(keydata);
    2.13      free_identity(me);