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


test/ssltest.c:428:1: start of procedure cb_server_alpn()
426.   }
427.   
428. > static int cb_server_alpn(SSL *s, const unsigned char **out,
429.                             unsigned char *outlen, const unsigned char *in,
430.                             unsigned int inlen, void *arg)

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

test/ssltest.c:436:9: Taking false branch
434.   
435.       protos = next_protos_parse(&protos_len, alpn_server);
436.       if (protos == NULL) {
               ^
437.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
438.                   alpn_server);

test/ssltest.c:442:9: Taking false branch
440.       }
441.   
442.       if (SSL_select_next_proto
               ^
443.           ((unsigned char **)out, outlen, protos, protos_len, in,
444.            inlen) != OPENSSL_NPN_NEGOTIATED) {

test/ssltest.c:453:5: 
451.        * verify_alpn.
452.        */
453. >     alpn_selected = OPENSSL_malloc(*outlen);
454.       memcpy(alpn_selected, *out, *outlen);
455.       *out = alpn_selected;

crypto/mem.c:398:1: start of procedure CRYPTO_malloc()
  396.   }
  397.   
  398. > void *CRYPTO_malloc(int num, const char *file, int line)
  399.   {
  400.       void *ret = NULL;

crypto/mem.c:400:5: 
  398.   void *CRYPTO_malloc(int num, const char *file, int line)
  399.   {
  400. >     void *ret = NULL;
  401.   
  402.       if (num <= 0)

crypto/mem.c:402:9: Taking true branch
  400.       void *ret = NULL;
  401.   
  402.       if (num <= 0)
                 ^
  403.           return NULL;
  404.   

crypto/mem.c:403:9: 
  401.   
  402.       if (num <= 0)
  403. >         return NULL;
  404.   
  405.       if (allow_customize)

crypto/mem.c:432:1: return from a call to CRYPTO_malloc
  430.   
  431.       return ret;
  432. > }
  433.   
  434.   char *CRYPTO_strdup(const char *str, const char *file, int line)

test/ssltest.c:454:5: 
452.        */
453.       alpn_selected = OPENSSL_malloc(*outlen);
454. >     memcpy(alpn_selected, *out, *outlen);
455.       *out = alpn_selected;
456.   
