crypto/evp/evp_pbe.c:126: error: NULL_DEREFERENCE
  pointer `pbe_algs` last assigned on line 117 could be null and is dereferenced by call to `sk_push()` at line 126, column 2.
Showing all 16 steps of the trace


crypto/evp/evp_pbe.c:113:1: start of procedure EVP_PBE_alg_add()
111.   /* Add a PBE algorithm */
112.   
113. > int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
114.   	     EVP_PBE_KEYGEN *keygen)
115.   {

crypto/evp/evp_pbe.c:117:7: Taking true branch
115.   {
116.   	EVP_PBE_CTL *pbe_tmp;
117.   	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
             ^
118.   	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
119.   		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);

crypto/evp/evp_pbe.c:117:17: 
115.   {
116.   	EVP_PBE_CTL *pbe_tmp;
117. > 	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
118.   	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
119.   		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);

crypto/stack/stack.c:112:1: start of procedure sk_new()
  110.   	}
  111.   
  112. > STACK *sk_new(int (*c)())
  113.   	{
  114.   	STACK *ret;

crypto/stack/stack.c:117:6: Taking true branch
  115.   	int i;
  116.   
  117.   	if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
              ^
  118.   		goto err0;
  119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/stack/stack.c:130:1: 
  128.   err1:
  129.   	Free((char *)ret);
  130. > err0:
  131.   	return(NULL);
  132.   	}

crypto/stack/stack.c:131:2: 
  129.   	Free((char *)ret);
  130.   err0:
  131. > 	return(NULL);
  132.   	}
  133.   

crypto/stack/stack.c:132:2: return from a call to sk_new
  130.   err0:
  131.   	return(NULL);
  132.   	}
          ^
  133.   
  134.   int sk_insert(STACK *st, char *data, int loc)

crypto/evp/evp_pbe.c:118:8: Taking false branch
116.   	EVP_PBE_CTL *pbe_tmp;
117.   	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
118.   	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
              ^
119.   		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
120.   		return 0;

crypto/evp/evp_pbe.c:122:2: 
120.   		return 0;
121.   	}
122. > 	pbe_tmp->pbe_nid = nid;
123.   	pbe_tmp->cipher = cipher;
124.   	pbe_tmp->md = md;

crypto/evp/evp_pbe.c:123:2: 
121.   	}
122.   	pbe_tmp->pbe_nid = nid;
123. > 	pbe_tmp->cipher = cipher;
124.   	pbe_tmp->md = md;
125.   	pbe_tmp->keygen = keygen;

crypto/evp/evp_pbe.c:124:2: 
122.   	pbe_tmp->pbe_nid = nid;
123.   	pbe_tmp->cipher = cipher;
124. > 	pbe_tmp->md = md;
125.   	pbe_tmp->keygen = keygen;
126.   	sk_push (pbe_algs, (char *)pbe_tmp);

crypto/evp/evp_pbe.c:125:2: 
123.   	pbe_tmp->cipher = cipher;
124.   	pbe_tmp->md = md;
125. > 	pbe_tmp->keygen = keygen;
126.   	sk_push (pbe_algs, (char *)pbe_tmp);
127.   	return 1;

crypto/evp/evp_pbe.c:126:2: 
124.   	pbe_tmp->md = md;
125.   	pbe_tmp->keygen = keygen;
126. > 	sk_push (pbe_algs, (char *)pbe_tmp);
127.   	return 1;
128.   }

crypto/stack/stack.c:233:1: start of procedure sk_push()
  231.   	}
  232.   
  233. > int sk_push(STACK *st, char *data)
  234.   	{
  235.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:235:2: Skipping sk_insert(): empty list of specs
  233.   int sk_push(STACK *st, char *data)
  234.   	{
  235.   	return(sk_insert(st,data,st->num));
          ^
  236.   	}
  237.   

int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
	     EVP_PBE_KEYGEN *keygen)
{
	EVP_PBE_CTL *pbe_tmp;
	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
		return 0;
	}
	pbe_tmp->pbe_nid = nid;
	pbe_tmp->cipher = cipher;
	pbe_tmp->md = md;
	pbe_tmp->keygen = keygen;
	sk_push (pbe_algs, (char *)pbe_tmp);
	return 1;
}
['int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,\n\t     EVP_PBE_KEYGEN *keygen)\n{\n\tEVP_PBE_CTL *pbe_tmp;\n\tif (!pbe_algs) pbe_algs = sk_new (pbe_cmp);\n\tif (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {\n\t\tEVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);\n\t\treturn 0;\n\t}\n\tpbe_tmp->pbe_nid = nid;\n\tpbe_tmp->cipher = cipher;\n\tpbe_tmp->md = md;\n\tpbe_tmp->keygen = keygen;\n\tsk_push (pbe_algs, (char *)pbe_tmp);\n\treturn 1;\n}', 'STACK *sk_new(int (*c)())\n\t{\n\tSTACK *ret;\n\tint i;\n\tif ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)\n\t\tgoto err0;\n\tif ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)\n\t\tgoto err1;\n\tfor (i=0; i<MIN_NODES; i++)\n\t\tret->data[i]=NULL;\n\tret->comp=c;\n\tret->num_alloc=MIN_NODES;\n\tret->num=0;\n\tret->sorted=0;\n\treturn(ret);\nerr1:\n\tFree((char *)ret);\nerr0:\n\treturn(NULL);\n\t}', 'int sk_push(STACK *st, char *data)\n\t{\n\treturn(sk_insert(st,data,st->num));\n\t}']