ssl/d1_srtp.c:323: error: NULL_DEREFERENCE
  pointer `clnt` last assigned on line 314 could be null and is dereferenced by call to `sk_push()` at line 323, column 4.
Showing all 32 steps of the trace


ssl/d1_srtp.c:299:1: start of procedure ssl_parse_clienthello_use_srtp_ext()
297.   
298.   
299. > int ssl_parse_clienthello_use_srtp_ext(SSL *s, unsigned char *d, int len,int *al)
300.   	{
301.   	SRTP_PROTECTION_PROFILE *cprof,*sprof;

ssl/d1_srtp.c:302:2: 
300.   	{
301.   	SRTP_PROTECTION_PROFILE *cprof,*sprof;
302. > 	STACK_OF(SRTP_PROTECTION_PROFILE) *clnt=0,*srvr;
303.   	int i,j;
304.   	int id;

ssl/d1_srtp.c:307:5: Taking false branch
305.   	int ret;
306.       
307.   	if(len%2)
           ^
308.   		{
309.   		SSLerr(SSL_F_SSL_PARSE_CLIENTHELLO_USE_SRTP_EXT,SSL_R_BAD_SRTP_PROTECTION_PROFILE_LIST);

ssl/d1_srtp.c:314:2: 
312.   		}
313.   
314. > 	clnt=sk_SRTP_PROTECTION_PROFILE_new_null();
315.   
316.   	while(len)

crypto/stack/stack.c:115:1: start of procedure sk_new_null()
  113.   	}
  114.   
  115. > _STACK *sk_new_null(void)
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:117:2: 
  115.   _STACK *sk_new_null(void)
  116.   	{
  117. > 	return sk_new((int (*)(const void *, const void *))0);
  118.   	}
  119.   

crypto/stack/stack.c:120:1: start of procedure sk_new()
    118.   	}
    119.   
    120. > _STACK *sk_new(int (*c)(const void *, const void *))
    121.   	{
    122.   	_STACK *ret;

crypto/stack/stack.c:125:6: 
    123.   	int i;
    124.   
    125. > 	if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL)
    126.   		goto err;
    127.   	if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
      295.   	}
      296.   
      297. > void *CRYPTO_malloc(int num, const char *file, int line)
      298.   	{
      299.   	void *ret = NULL;

crypto/mem.c:299:2: 
      297.   void *CRYPTO_malloc(int num, const char *file, int line)
      298.   	{
      299. > 	void *ret = NULL;
      300.   
      301.   	if (num <= 0) return NULL;

crypto/mem.c:301:6: Taking false branch
      299.   	void *ret = NULL;
      300.   
      301.   	if (num <= 0) return NULL;
                  ^
      302.   
      303.   	allow_customize = 0;

crypto/mem.c:303:2: 
      301.   	if (num <= 0) return NULL;
      302.   
      303. > 	allow_customize = 0;
      304.   	if (malloc_debug_func != NULL)
      305.   		{

crypto/mem.c:304:6: Taking false branch
      302.   
      303.   	allow_customize = 0;
      304.   	if (malloc_debug_func != NULL)
                  ^
      305.   		{
      306.   		allow_customize_debug = 0;

crypto/mem.c:309:2: Skipping __function_pointer__(): unresolved function pointer
      307.   		malloc_debug_func(NULL, num, file, line, 0);
      308.   		}
      309.   	ret = malloc_ex_func(num,file,line);
              ^
      310.   #ifdef LEVITTE_DEBUG_MEM
      311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:313:6: Taking false branch
      311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      312.   #endif
      313.   	if (malloc_debug_func != NULL)
                  ^
      314.   		malloc_debug_func(ret, num, file, line, 1);
      315.   

crypto/mem.c:320:12: Taking false branch
      318.            * sanitisation function can't be optimised out. NB: We only do
      319.            * this for >2Kb so the overhead doesn't bother us. */
      320.           if(ret && (num > 2048))
                        ^
      321.   	{	extern unsigned char cleanse_ctr;
      322.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:326:2: 
      324.   #endif
      325.   
      326. > 	return ret;
      327.   	}
      328.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:327:2: return from a call to CRYPTO_malloc
      325.   
      326.   	return ret;
      327.   	}
              ^
      328.   char *CRYPTO_strdup(const char *str, const char *file, int line)
      329.   	{

crypto/stack/stack.c:125:6: Taking true branch
    123.   	int i;
    124.   
    125.   	if ((ret=OPENSSL_malloc(sizeof(_STACK))) == NULL)
                ^
    126.   		goto err;
    127.   	if ((ret->data=OPENSSL_malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/stack/stack.c:136:1: 
    134.   	ret->sorted=0;
    135.   	return(ret);
    136. > err:
    137.   	if(ret)
    138.   		OPENSSL_free(ret);

crypto/stack/stack.c:137:5: Taking false branch
    135.   	return(ret);
    136.   err:
    137.   	if(ret)
               ^
    138.   		OPENSSL_free(ret);
    139.   	return(NULL);

crypto/stack/stack.c:139:2: 
    137.   	if(ret)
    138.   		OPENSSL_free(ret);
    139. > 	return(NULL);
    140.   	}
    141.   

crypto/stack/stack.c:140:2: return from a call to sk_new
    138.   		OPENSSL_free(ret);
    139.   	return(NULL);
    140.   	}
            ^
    141.   
    142.   int sk_insert(_STACK *st, void *data, int loc)

crypto/stack/stack.c:118:2: return from a call to sk_new_null
  116.   	{
  117.   	return sk_new((int (*)(const void *, const void *))0);
  118.   	}
          ^
  119.   
  120.   _STACK *sk_new(int (*c)(const void *, const void *))

ssl/d1_srtp.c:316:8: Loop condition is true. Entering loop body
314.   	clnt=sk_SRTP_PROTECTION_PROFILE_new_null();
315.   
316.   	while(len)
              ^
317.   		{
318.   		n2s(d,id);

ssl/d1_srtp.c:318:3: 
316.   	while(len)
317.   		{
318. > 		n2s(d,id);
319.   		len-=2;
320.   

ssl/d1_srtp.c:319:3: 
317.   		{
318.   		n2s(d,id);
319. > 		len-=2;
320.   
321.   		if(!find_profile_by_num(id,&cprof))

ssl/d1_srtp.c:321:7: Taking true branch
319.   		len-=2;
320.   
321.   		if(!find_profile_by_num(id,&cprof))
             ^
322.   			{
323.   			sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);

ssl/d1_srtp.c:323:4: Condition is true
321.   		if(!find_profile_by_num(id,&cprof))
322.   			{
323.   			sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);
          ^
324.   			}
325.   		else

ssl/d1_srtp.c:323:4: Condition is true
321.   		if(!find_profile_by_num(id,&cprof))
322.   			{
323.   			sk_SRTP_PROTECTION_PROFILE_push(clnt,cprof);
          ^
324.   			}
325.   		else

crypto/stack/stack.c:244:1: start of procedure sk_push()
  242.   	}
  243.   
  244. > int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:246:2: Skipping sk_insert(): empty list of specs
  244.   int sk_push(_STACK *st, void *data)
  245.   	{
  246.   	return(sk_insert(st,data,st->num));
          ^
  247.   	}
  248.   
