apps/engine.c:332: error: USE_AFTER_FREE
  call to `sk_OPENSSL_STRING_push()` eventually accesses memory that was invalidated by call to `free()` on line 332 indirectly during the call to `sk_OPENSSL_STRING_push()`.
Showing all 22 steps of the trace


apps/engine.c:315:41: invalidation part of the trace starts here
313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
314.       ENGINE *e;
315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
                                               ^
316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:315:41: passed as argument to `sk_OPENSSL_STRING_new_null`
  313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
  314.       ENGINE *e;
  315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
                                                 ^
  316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
  317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:315:41: return from call to `sk_OPENSSL_STRING_new_null`
  313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
  314.       ENGINE *e;
  315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
                                                 ^
  316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
  317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:315:5: assigned
  313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
  314.       ENGINE *e;
  315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
             ^
  316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
  317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:332:9: when calling `sk_OPENSSL_STRING_push` here
  330.       prog = argv[0];
  331.       while ((argv1 = argv[1]) != NULL && *argv1 != '-') {
  332.           sk_OPENSSL_STRING_push(engines, argv1);
                 ^
  333.           argc--;
  334.           argv++;

include/openssl/safestack.h:214:1: parameter `sk` of sk_OPENSSL_STRING_push
    212.    * dealt with in the autogenerated macros below.
    213.    */
    214. > DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
    215.   
    216.   /*

include/openssl/safestack.h:214:1: when calling `sk_push` here
    212.    * dealt with in the autogenerated macros below.
    213.    */
    214. > DEFINE_SPECIAL_STACK_OF(OPENSSL_STRING, char)
    215.   
    216.   /*

crypto/stack/stack.c:258:1: parameter `st` of sk_push
      256.   }
      257.   
      258. > int sk_push(_STACK *st, void *data)
      259.   {
      260.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:260:13: when calling `sk_insert` here
      258.   int sk_push(_STACK *st, void *data)
      259.   {
      260.       return (sk_insert(st, data, st->num));
                         ^
      261.   }
      262.   

crypto/stack/stack.c:166:1: parameter `st` of sk_insert
        164.   }
        165.   
        166. > int sk_insert(_STACK *st, void *data, int loc)
        167.   {
        168.       char **s;

crypto/stack/stack.c:173:13: when calling `CRYPTO_realloc` here
        171.           return 0;
        172.       if (st->num_alloc <= st->num + 1) {
        173.           s = OPENSSL_realloc((char *)st->data,
                           ^
        174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);
        175.           if (s == NULL)

crypto/mem.c:165:1: parameter `str` of CRYPTO_realloc
          163.   }
          164.   
          165. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
          166.   {
          167.       if (str == NULL)

crypto/mem.c:171:9: when calling `CRYPTO_free` here
          169.   
          170.       if (num == 0) {
          171.           CRYPTO_free(str);
                         ^
          172.           return NULL;
          173.       }

crypto/mem.c:233:1: parameter `str` of CRYPTO_free
            231.   }
            232.   
            233. > void CRYPTO_free(void *str)
            234.   {
            235.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:244:5: was invalidated by call to `free()`
            242.       }
            243.   #else
            244.       free(str);
                       ^
            245.   #endif
            246.   }

apps/engine.c:315:41: use-after-lifetime part of the trace starts here
313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
314.       ENGINE *e;
315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
                                               ^
316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:315:41: passed as argument to `sk_OPENSSL_STRING_new_null`
  313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
  314.       ENGINE *e;
  315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
                                                 ^
  316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
  317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:315:41: return from call to `sk_OPENSSL_STRING_new_null`
  313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
  314.       ENGINE *e;
  315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
                                                 ^
  316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
  317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:315:5: assigned
  313.       int verbose = 0, list_cap = 0, test_avail = 0, test_avail_noise = 0;
  314.       ENGINE *e;
  315.       STACK_OF(OPENSSL_STRING) *engines = sk_OPENSSL_STRING_new_null();
             ^
  316.       STACK_OF(OPENSSL_STRING) *pre_cmds = sk_OPENSSL_STRING_new_null();
  317.       STACK_OF(OPENSSL_STRING) *post_cmds = sk_OPENSSL_STRING_new_null();

apps/engine.c:332:9: when calling `sk_OPENSSL_STRING_push` here
  330.       prog = argv[0];
  331.       while ((argv1 = argv[1]) != NULL && *argv1 != '-') {
  332.           sk_OPENSSL_STRING_push(engines, argv1);
                 ^
  333.           argc--;
  334.           argv++;

crypto/mem.c:233:1: parameter `str` of CRYPTO_free
    231.   }
    232.   
    233. > void CRYPTO_free(void *str)
    234.   {
    235.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:244:5: invalid access occurs here
    242.       }
    243.   #else
    244.       free(str);
               ^
    245.   #endif
    246.   }
