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


crypto/evp/evp_pbe.c:150:1: start of procedure EVP_PBE_alg_add()
148.   /* Add a PBE algorithm */
149.   
150. > int EVP_PBE_alg_add (int nid, EVP_CIPHER *cipher, EVP_MD *md,
151.   	     EVP_PBE_KEYGEN *keygen)
152.   {

crypto/evp/evp_pbe.c:154:7: Taking true branch
152.   {
153.   	EVP_PBE_CTL *pbe_tmp;
154.   	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
             ^
155.   	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
156.   		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);

crypto/evp/evp_pbe.c:154:17: 
152.   {
153.   	EVP_PBE_CTL *pbe_tmp;
154. > 	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
155.   	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
156.   		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);

crypto/stack/stack.c:117:1: start of procedure sk_new()
  115.   	}
  116.   
  117. > STACK *sk_new(int (*c)())
  118.   	{
  119.   	STACK *ret;

crypto/stack/stack.c:122:6: Taking true branch
  120.   	int i;
  121.   
  122.   	if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
              ^
  123.   		goto err0;
  124.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)

crypto/stack/stack.c:135:1: 
  133.   err1:
  134.   	Free((char *)ret);
  135. > err0:
  136.   	return(NULL);
  137.   	}

crypto/stack/stack.c:136:2: 
  134.   	Free((char *)ret);
  135.   err0:
  136. > 	return(NULL);
  137.   	}
  138.   

crypto/stack/stack.c:137:2: return from a call to sk_new
  135.   err0:
  136.   	return(NULL);
  137.   	}
          ^
  138.   
  139.   int sk_insert(STACK *st, char *data, int loc)

crypto/evp/evp_pbe.c:155:8: Taking false branch
153.   	EVP_PBE_CTL *pbe_tmp;
154.   	if (!pbe_algs) pbe_algs = sk_new (pbe_cmp);
155.   	if (!(pbe_tmp = (EVP_PBE_CTL*) Malloc (sizeof(EVP_PBE_CTL)))) {
              ^
156.   		EVPerr(EVP_F_EVP_PBE_ALG_ADD,ERR_R_MALLOC_FAILURE);
157.   		return 0;

crypto/evp/evp_pbe.c:159:2: 
157.   		return 0;
158.   	}
159. > 	pbe_tmp->pbe_nid = nid;
160.   	pbe_tmp->cipher = cipher;
161.   	pbe_tmp->md = md;

crypto/evp/evp_pbe.c:160:2: 
158.   	}
159.   	pbe_tmp->pbe_nid = nid;
160. > 	pbe_tmp->cipher = cipher;
161.   	pbe_tmp->md = md;
162.   	pbe_tmp->keygen = keygen;

crypto/evp/evp_pbe.c:161:2: 
159.   	pbe_tmp->pbe_nid = nid;
160.   	pbe_tmp->cipher = cipher;
161. > 	pbe_tmp->md = md;
162.   	pbe_tmp->keygen = keygen;
163.   	sk_push (pbe_algs, (char *)pbe_tmp);

crypto/evp/evp_pbe.c:162:2: 
160.   	pbe_tmp->cipher = cipher;
161.   	pbe_tmp->md = md;
162. > 	pbe_tmp->keygen = keygen;
163.   	sk_push (pbe_algs, (char *)pbe_tmp);
164.   	return 1;

crypto/evp/evp_pbe.c:163:2: 
161.   	pbe_tmp->md = md;
162.   	pbe_tmp->keygen = keygen;
163. > 	sk_push (pbe_algs, (char *)pbe_tmp);
164.   	return 1;
165.   }

crypto/stack/stack.c:239:1: start of procedure sk_push()
  237.   	}
  238.   
  239. > int sk_push(STACK *st, char *data)
  240.   	{
  241.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:241:2: Skipping sk_insert(): empty list of specs
  239.   int sk_push(STACK *st, char *data)
  240.   	{
  241.   	return(sk_insert(st,data,st->num));
          ^
  242.   	}
  243.   

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}']