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


crypto/conf/conf_mod.c:389:32: invalidation part of the trace starts here
387.   {
388.       CONF_IMODULE *imod;
389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                      ^
390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
391.           module_finish(imod);

crypto/conf/conf_mod.c:389:32: global variable `initialized_modules` accessed here
  387.   {
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                        ^
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  391.           module_finish(imod);

crypto/conf/conf_mod.c:390:16: passed as argument to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

include/openssl/conf.h:57:1: parameter `sk` of sk_CONF_IMODULE_pop
    55.   
    56.   DEFINE_STACK_OF(CONF_MODULE)
    57. > DEFINE_STACK_OF(CONF_IMODULE)
    58.   
    59.   /* DSO module function typedefs */

include/openssl/conf.h:57:1: passed as argument to `OPENSSL_sk_pop`
    55.   
    56.   DEFINE_STACK_OF(CONF_MODULE)
    57. > DEFINE_STACK_OF(CONF_IMODULE)
    58.   
    59.   /* DSO module function typedefs */

crypto/stack/stack.c:238:1: parameter `st` of OPENSSL_sk_pop
      236.   }
      237.   
      238. > void *OPENSSL_sk_pop(OPENSSL_STACK *st)
      239.   {
      240.       if (st == NULL)

crypto/stack/stack.c:244:13: passed as argument to `OPENSSL_sk_delete`
      242.       if (st->num <= 0)
      243.           return (NULL);
      244.       return (OPENSSL_sk_delete(st, st->num - 1));
                         ^
      245.   }
      246.   

crypto/stack/stack.c:178:10: passed as argument to function `memmove` with no summary
        176.       ret = st->data[loc];
        177.       if (loc != st->num - 1)
        178.            memmove(&st->data[loc], &st->data[loc + 1],
                        ^
        179.                    sizeof(st->data[0]) * (st->num - loc - 1));
        180.       st->num--;

crypto/stack/stack.c:178:10: return from call to function `memmove` with no summary
        176.       ret = st->data[loc];
        177.       if (loc != st->num - 1)
        178.            memmove(&st->data[loc], &st->data[loc + 1],
                        ^
        179.                    sizeof(st->data[0]) * (st->num - loc - 1));
        180.       st->num--;

crypto/stack/stack.c:244:13: return from call to `OPENSSL_sk_delete`
      242.       if (st->num <= 0)
      243.           return (NULL);
      244.       return (OPENSSL_sk_delete(st, st->num - 1));
                         ^
      245.   }
      246.   

include/openssl/conf.h:57:1: return from call to `OPENSSL_sk_pop`
    55.   
    56.   DEFINE_STACK_OF(CONF_MODULE)
    57. > DEFINE_STACK_OF(CONF_IMODULE)
    58.   
    59.   /* DSO module function typedefs */

crypto/conf/conf_mod.c:390:16: return from call to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:390:16: passed as argument to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:390:16: return from call to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:390:9: assigned
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                 ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:391:9: when calling `module_finish` here
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  391.           module_finish(imod);
                 ^
  392.       }
  393.       sk_CONF_IMODULE_free(initialized_modules);

crypto/conf/conf_mod.c:399:1: parameter `imod` of module_finish
    397.   /* finish a module instance */
    398.   
    399. > static void module_finish(CONF_IMODULE *imod)
    400.   {
    401.       if (!imod)

crypto/conf/conf_mod.c:408:5: when calling `CRYPTO_free` here
    406.       OPENSSL_free(imod->name);
    407.       OPENSSL_free(imod->value);
    408.       OPENSSL_free(imod);
               ^
    409.   }
    410.   

crypto/mem.c:264:1: parameter `str` of CRYPTO_free
      262.   }
      263.   
      264. > void CRYPTO_free(void *str, const char *file, int line)
      265.   {
      266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:280:5: was invalidated by call to `free()`
      278.       }
      279.   #else
      280.       free(str);
                 ^
      281.   #endif
      282.   }

crypto/conf/conf_mod.c:389:32: use-after-lifetime part of the trace starts here
387.   {
388.       CONF_IMODULE *imod;
389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                      ^
390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
391.           module_finish(imod);

crypto/conf/conf_mod.c:389:32: global variable `initialized_modules` accessed here
  387.   {
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
                                        ^
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  391.           module_finish(imod);

crypto/conf/conf_mod.c:390:16: passed as argument to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

include/openssl/conf.h:57:1: parameter `sk` of sk_CONF_IMODULE_pop
    55.   
    56.   DEFINE_STACK_OF(CONF_MODULE)
    57. > DEFINE_STACK_OF(CONF_IMODULE)
    58.   
    59.   /* DSO module function typedefs */

include/openssl/conf.h:57:1: passed as argument to `OPENSSL_sk_pop`
    55.   
    56.   DEFINE_STACK_OF(CONF_MODULE)
    57. > DEFINE_STACK_OF(CONF_IMODULE)
    58.   
    59.   /* DSO module function typedefs */

crypto/stack/stack.c:238:1: parameter `st` of OPENSSL_sk_pop
      236.   }
      237.   
      238. > void *OPENSSL_sk_pop(OPENSSL_STACK *st)
      239.   {
      240.       if (st == NULL)

crypto/stack/stack.c:244:13: passed as argument to `OPENSSL_sk_delete`
      242.       if (st->num <= 0)
      243.           return (NULL);
      244.       return (OPENSSL_sk_delete(st, st->num - 1));
                         ^
      245.   }
      246.   

crypto/stack/stack.c:178:10: passed as argument to function `memmove` with no summary
        176.       ret = st->data[loc];
        177.       if (loc != st->num - 1)
        178.            memmove(&st->data[loc], &st->data[loc + 1],
                        ^
        179.                    sizeof(st->data[0]) * (st->num - loc - 1));
        180.       st->num--;

crypto/stack/stack.c:178:10: return from call to function `memmove` with no summary
        176.       ret = st->data[loc];
        177.       if (loc != st->num - 1)
        178.            memmove(&st->data[loc], &st->data[loc + 1],
                        ^
        179.                    sizeof(st->data[0]) * (st->num - loc - 1));
        180.       st->num--;

crypto/stack/stack.c:244:13: return from call to `OPENSSL_sk_delete`
      242.       if (st->num <= 0)
      243.           return (NULL);
      244.       return (OPENSSL_sk_delete(st, st->num - 1));
                         ^
      245.   }
      246.   

include/openssl/conf.h:57:1: return from call to `OPENSSL_sk_pop`
    55.   
    56.   DEFINE_STACK_OF(CONF_MODULE)
    57. > DEFINE_STACK_OF(CONF_IMODULE)
    58.   
    59.   /* DSO module function typedefs */

crypto/conf/conf_mod.c:390:16: return from call to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:390:16: passed as argument to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:390:16: return from call to `sk_CONF_IMODULE_pop`
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                        ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:390:9: assigned
  388.       CONF_IMODULE *imod;
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
                 ^
  391.           module_finish(imod);
  392.       }

crypto/conf/conf_mod.c:391:9: when calling `module_finish` here
  389.       while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
  390.           imod = sk_CONF_IMODULE_pop(initialized_modules);
  391.           module_finish(imod);
                 ^
  392.       }
  393.       sk_CONF_IMODULE_free(initialized_modules);

crypto/conf/conf_mod.c:399:1: parameter `imod` of module_finish
    397.   /* finish a module instance */
    398.   
    399. > static void module_finish(CONF_IMODULE *imod)
    400.   {
    401.       if (!imod)

crypto/conf/conf_mod.c:408:5: when calling `CRYPTO_free` here
    406.       OPENSSL_free(imod->name);
    407.       OPENSSL_free(imod->value);
    408.       OPENSSL_free(imod);
               ^
    409.   }
    410.   

crypto/mem.c:264:1: parameter `str` of CRYPTO_free
      262.   }
      263.   
      264. > void CRYPTO_free(void *str, const char *file, int line)
      265.   {
      266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:280:5: invalid access occurs here
      278.       }
      279.   #else
      280.       free(str);
                 ^
      281.   #endif
      282.   }
