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 15 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:120:1: start of procedure CRYPTO_malloc()
  118.   }
  119.   
  120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  121.   {
  122.       void *ret = NULL;

crypto/mem.c:122:5: 
  120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  121.   {
  122. >     void *ret = NULL;
  123.   
  124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
  122.       void *ret = NULL;
  123.   
  124.       if (num <= 0)
                 ^
  125.           return NULL;
  126.   

crypto/mem.c:127:5: 
  125.           return NULL;
  126.   
  127. >     allow_customize = 0;
  128.   #ifdef CRYPTO_MDEBUG
  129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
  135.       }
  136.   #else
  137. >     (void)file;
  138.       (void)line;
  139.       ret = malloc(num);

crypto/mem.c:138:5: 
  136.   #else
  137.       (void)file;
  138. >     (void)line;
  139.       ret = malloc(num);
  140.   #endif

crypto/mem.c:139:5: 
  137.       (void)file;
  138.       (void)line;
  139. >     ret = malloc(num);
  140.   #endif
  141.   

crypto/mem.c:154:5: 
  152.   #endif
  153.   
  154. >     return ret;
  155.   }
  156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
  153.   
  154.       return ret;
  155. > }
  156.   
  157.   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.   
