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


test/ssltest_old.c:294:1: start of procedure cb_server_alpn()
292.   }
293.   
294. > static int cb_server_alpn(SSL *s, const unsigned char **out,
295.                             unsigned char *outlen, const unsigned char *in,
296.                             unsigned int inlen, void *arg)

test/ssltest_old.c:300:5: 
298.       unsigned char *protos;
299.       size_t protos_len;
300. >     char* alpn_str = arg;
301.   
302.       protos = next_protos_parse(&protos_len, alpn_str);

test/ssltest_old.c:302:5: Skipping next_protos_parse(): empty list of specs
300.       char* alpn_str = arg;
301.   
302.       protos = next_protos_parse(&protos_len, alpn_str);
           ^
303.       if (protos == NULL) {
304.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",

test/ssltest_old.c:303:9: Taking false branch
301.   
302.       protos = next_protos_parse(&protos_len, alpn_str);
303.       if (protos == NULL) {
               ^
304.           fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
305.                   alpn_str);

test/ssltest_old.c:309:9: Taking false branch
307.       }
308.   
309.       if (SSL_select_next_proto
               ^
310.           ((unsigned char **)out, outlen, protos, protos_len, in,
311.            inlen) != OPENSSL_NPN_NEGOTIATED) {

test/ssltest_old.c:320:5: 
318.        * verify_alpn.
319.        */
320. >     alpn_selected = OPENSSL_malloc(*outlen);
321.       memcpy(alpn_selected, *out, *outlen);
322.       *out = alpn_selected;

crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
  187.   #endif
  188.   
  189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191.       void *ret = NULL;

crypto/mem.c:191:5: 
  189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  190.   {
  191. >     void *ret = NULL;
  192.   
  193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking true branch
  192.   
  193.       INCREMENT(malloc_count);
  194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  195.           return malloc_impl(num, file, line);
  196.   

crypto/mem.c:194:32: Taking false branch
  192.   
  193.       INCREMENT(malloc_count);
  194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                        ^
  195.           return malloc_impl(num, file, line);
  196.   

crypto/mem.c:197:9: Taking false branch
  195.           return malloc_impl(num, file, line);
  196.   
  197.       if (num == 0)
                 ^
  198.           return NULL;
  199.   

crypto/mem.c:201:5: 
  199.   
  200.       FAILTEST();
  201. >     allow_customize = 0;
  202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:211:19: 
  209.       }
  210.   #else
  211. >     (void)(file); (void)(line);
  212.       ret = malloc(num);
  213.   #endif

crypto/mem.c:212:5: 
  210.   #else
  211.       (void)(file); (void)(line);
  212. >     ret = malloc(num);
  213.   #endif
  214.   

crypto/mem.c:215:5: 
  213.   #endif
  214.   
  215. >     return ret;
  216.   }
  217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
  214.   
  215.       return ret;
  216. > }
  217.   
  218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

test/ssltest_old.c:321:5: 
319.        */
320.       alpn_selected = OPENSSL_malloc(*outlen);
321. >     memcpy(alpn_selected, *out, *outlen);
322.       *out = alpn_selected;
323.   
