crypto/conf/conf_mod.c:399: error: USE_AFTER_FREE
  call to `module_finish()` eventually accesses memory that was invalidated by call to `free()` on line 399 indirectly during the call to `module_finish()`.
Showing all 20 steps of the trace


crypto/conf/conf_mod.c:397:32: invalidation part of the trace starts here
395.   {
396.       CONF_IMODULE *imod;
397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                      ^
398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
399.           module_finish(imod);

crypto/conf/conf_mod.c:397:32: global variable `initialized_modules` accessed here
  395.   {
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                        ^
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  399.           module_finish(imod);

crypto/conf/conf_mod.c:398:16: passed as argument to `sk_CONF_IMODULE_pop`
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  399.           module_finish(imod);
  400.       }

crypto/conf/conf_mod.c:398:16: return from call to `sk_CONF_IMODULE_pop`
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  399.           module_finish(imod);
  400.       }

crypto/conf/conf_mod.c:398:9: assigned
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                 ^
  399.           module_finish(imod);
  400.       }

crypto/conf/conf_mod.c:399:9: when calling `module_finish` here
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  399.           module_finish(imod);
                 ^
  400.       }
  401.       sk_CONF_IMODULE_free(initialized_modules);

crypto/conf/conf_mod.c:407:1: parameter `imod` of module_finish
    405.   /* finish a module instance */
    406.   
    407. > static void module_finish(CONF_IMODULE *imod)
    408.   {
    409.       if (!imod)

crypto/conf/conf_mod.c:416:5: when calling `CRYPTO_free` here
    414.       OPENSSL_free(imod->name);
    415.       OPENSSL_free(imod->value);
    416.       OPENSSL_free(imod);
               ^
    417.   }
    418.   

crypto/mem.c:295:1: parameter `str` of CRYPTO_free
      293.   }
      294.   
      295. > void CRYPTO_free(void *str, const char *file, int line)
      296.   {
      297.       INCREMENT(free_count);

crypto/mem.c:312:5: was invalidated by call to `free()`
      310.       }
      311.   #else
      312.       free(str);
                 ^
      313.   #endif
      314.   }

crypto/conf/conf_mod.c:397:32: use-after-lifetime part of the trace starts here
395.   {
396.       CONF_IMODULE *imod;
397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                      ^
398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
399.           module_finish(imod);

crypto/conf/conf_mod.c:397:32: global variable `initialized_modules` accessed here
  395.   {
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                        ^
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  399.           module_finish(imod);

crypto/conf/conf_mod.c:398:16: passed as argument to `sk_CONF_IMODULE_pop`
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  399.           module_finish(imod);
  400.       }

crypto/conf/conf_mod.c:398:16: return from call to `sk_CONF_IMODULE_pop`
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  399.           module_finish(imod);
  400.       }

crypto/conf/conf_mod.c:398:9: assigned
  396.       CONF_IMODULE *imod;
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                 ^
  399.           module_finish(imod);
  400.       }

crypto/conf/conf_mod.c:399:9: when calling `module_finish` here
  397.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  398.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  399.           module_finish(imod);
                 ^
  400.       }
  401.       sk_CONF_IMODULE_free(initialized_modules);

crypto/conf/conf_mod.c:407:1: parameter `imod` of module_finish
    405.   /* finish a module instance */
    406.   
    407. > static void module_finish(CONF_IMODULE *imod)
    408.   {
    409.       if (!imod)

crypto/conf/conf_mod.c:416:5: when calling `CRYPTO_free` here
    414.       OPENSSL_free(imod->name);
    415.       OPENSSL_free(imod->value);
    416.       OPENSSL_free(imod);
               ^
    417.   }
    418.   

crypto/mem.c:295:1: parameter `str` of CRYPTO_free
      293.   }
      294.   
      295. > void CRYPTO_free(void *str, const char *file, int line)
      296.   {
      297.       INCREMENT(free_count);

crypto/mem.c:312:5: invalid access occurs here
      310.       }
      311.   #else
      312.       free(str);
                 ^
      313.   #endif
      314.   }
