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


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

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

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

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

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

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

crypto/mem.c:281:5: 
  279.   void *CRYPTO_malloc(int 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:313:1: return from a call to CRYPTO_malloc
  311.   
  312.       return ret;
  313. > }
  314.   
  315.   void *CRYPTO_zalloc(int num, const char *file, int line)

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