test/ssltest.c:442: error: NULL_DEREFERENCE
  pointer `alpn_selected` last assigned on line 441 could be null and is dereferenced by call to `memcpy()` at line 442, column 5.
Showing all 11 steps of the trace


test/ssltest.c:416:1: start of procedure cb_server_alpn()
414.   }
415.   
416. > static int cb_server_alpn(SSL *s, const unsigned char **out,
417.                             unsigned char *outlen, const unsigned char *in,
418.                             unsigned int inlen, void *arg)

test/ssltest.c:423:5: Skipping next_protos_parse(): empty list of specs
421.       unsigned short protos_len;
422.   
423.       protos = next_protos_parse(&protos_len, alpn_server);
           ^
424.       if (protos == NULL) {
425.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",

test/ssltest.c:424:9: Taking false branch
422.   
423.       protos = next_protos_parse(&protos_len, alpn_server);
424.       if (protos == NULL) {
               ^
425.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
426.                   alpn_server);

test/ssltest.c:430:9: Taking false branch
428.       }
429.   
430.       if (SSL_select_next_proto
               ^
431.           ((unsigned char **)out, outlen, protos, protos_len, in,
432.            inlen) != OPENSSL_NPN_NEGOTIATED) {

test/ssltest.c:441:5: 
439.        * verify_alpn.
440.        */
441. >     alpn_selected = OPENSSL_malloc(*outlen);
442.       memcpy(alpn_selected, *out, *outlen);
443.       *out = alpn_selected;

crypto/mem.c:279:1: start of procedure CRYPTO_malloc()
  277.   }
  278.   
  279. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  280.   {
  281.       void *ret = NULL;

crypto/mem.c:281:5: 
  279.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  280.   {
  281. >     void *ret = NULL;
  282.   
  283.       if (num <= 0)

crypto/mem.c:283:9: Taking true branch
  281.       void *ret = NULL;
  282.   
  283.       if (num <= 0)
                 ^
  284.           return NULL;
  285.   

crypto/mem.c:284:9: 
  282.   
  283.       if (num <= 0)
  284. >         return NULL;
  285.   
  286.       if (allow_customize)

crypto/mem.c:310:1: return from a call to CRYPTO_malloc
  308.   
  309.       return ret;
  310. > }
  311.   
  312.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

test/ssltest.c:442:5: 
440.        */
441.       alpn_selected = OPENSSL_malloc(*outlen);
442. >     memcpy(alpn_selected, *out, *outlen);
443.       *out = alpn_selected;
444.   
