crypto/stack/stack.c:99: error: MEMORY_LEAK
  memory dynamically allocated by call to `sk_new()` at line 96, column 11 is not reachable after line 99, column 6.
Showing all 19 steps of the trace


crypto/stack/stack.c:91:1: start of procedure sk_dup()
89.   	}
90.   
91. > STACK *sk_dup(STACK *sk)
92.   	{
93.   	STACK *ret;

crypto/stack/stack.c:96:6: 
94.   	char **s;
95.   
96. > 	if ((ret=sk_new(sk->comp)) == NULL) goto err;
97.   	s=(char **)Realloc((char *)ret->data,
98.   		(unsigned int)sizeof(char *)*sk->num_alloc);

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 false 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:119:6: Taking false branch
  117.   	if ((ret=(STACK *)Malloc(sizeof(STACK))) == NULL)
  118.   		goto err0;
  119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
              ^
  120.   		goto err1;
  121.   	for (i=0; i<MIN_NODES; i++)

crypto/stack/stack.c:121:7: 
  119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
  120.   		goto err1;
  121. > 	for (i=0; i<MIN_NODES; i++)
  122.   		ret->data[i]=NULL;
  123.   	ret->comp=c;

crypto/stack/stack.c:121:12: Loop condition is true. Entering loop body
  119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
  120.   		goto err1;
  121.   	for (i=0; i<MIN_NODES; i++)
                    ^
  122.   		ret->data[i]=NULL;
  123.   	ret->comp=c;

crypto/stack/stack.c:122:3: 
  120.   		goto err1;
  121.   	for (i=0; i<MIN_NODES; i++)
  122. > 		ret->data[i]=NULL;
  123.   	ret->comp=c;
  124.   	ret->num_alloc=MIN_NODES;

crypto/stack/stack.c:121:25: 
  119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
  120.   		goto err1;
  121. > 	for (i=0; i<MIN_NODES; i++)
  122.   		ret->data[i]=NULL;
  123.   	ret->comp=c;

crypto/stack/stack.c:121:12: Loop condition is false. Leaving loop
  119.   	if ((ret->data=(char **)Malloc(sizeof(char *)*MIN_NODES)) == NULL)
  120.   		goto err1;
  121.   	for (i=0; i<MIN_NODES; i++)
                    ^
  122.   		ret->data[i]=NULL;
  123.   	ret->comp=c;

crypto/stack/stack.c:123:2: 
  121.   	for (i=0; i<MIN_NODES; i++)
  122.   		ret->data[i]=NULL;
  123. > 	ret->comp=c;
  124.   	ret->num_alloc=MIN_NODES;
  125.   	ret->num=0;

crypto/stack/stack.c:124:2: 
  122.   		ret->data[i]=NULL;
  123.   	ret->comp=c;
  124. > 	ret->num_alloc=MIN_NODES;
  125.   	ret->num=0;
  126.   	ret->sorted=0;

crypto/stack/stack.c:125:2: 
  123.   	ret->comp=c;
  124.   	ret->num_alloc=MIN_NODES;
  125. > 	ret->num=0;
  126.   	ret->sorted=0;
  127.   	return(ret);

crypto/stack/stack.c:126:2: 
  124.   	ret->num_alloc=MIN_NODES;
  125.   	ret->num=0;
  126. > 	ret->sorted=0;
  127.   	return(ret);
  128.   err1:

crypto/stack/stack.c:127:2: 
  125.   	ret->num=0;
  126.   	ret->sorted=0;
  127. > 	return(ret);
  128.   err1:
  129.   	Free((char *)ret);

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/stack/stack.c:96:6: Taking false branch
94.   	char **s;
95.   
96.   	if ((ret=sk_new(sk->comp)) == NULL) goto err;
           ^
97.   	s=(char **)Realloc((char *)ret->data,
98.   		(unsigned int)sizeof(char *)*sk->num_alloc);

crypto/stack/stack.c:97:2: 
95.   
96.   	if ((ret=sk_new(sk->comp)) == NULL) goto err;
97. > 	s=(char **)Realloc((char *)ret->data,
98.   		(unsigned int)sizeof(char *)*sk->num_alloc);
99.   	if (s == NULL) goto err;

crypto/stack/stack.c:99:6: Taking true branch
97.   	s=(char **)Realloc((char *)ret->data,
98.   		(unsigned int)sizeof(char *)*sk->num_alloc);
99.   	if (s == NULL) goto err;
            ^
100.   	ret->data=s;
101.   

STACK *sk_dup(STACK *sk)
	{
	STACK *ret;
	char **s;
	if ((ret=sk_new(sk->comp)) == NULL) goto err;
	s=(char **)Realloc((char *)ret->data,
		(unsigned int)sizeof(char *)*sk->num_alloc);
	if (s == NULL) goto err;
	ret->data=s;
	ret->num=sk->num;
	memcpy(ret->data,sk->data,sizeof(char *)*sk->num);
	ret->sorted=sk->sorted;
	ret->num_alloc=sk->num_alloc;
	ret->comp=sk->comp;
	return(ret);
err:
	return(NULL);
	}
['STACK *sk_dup(STACK *sk)\n\t{\n\tSTACK *ret;\n\tchar **s;\n\tif ((ret=sk_new(sk->comp)) == NULL) goto err;\n\ts=(char **)Realloc((char *)ret->data,\n\t\t(unsigned int)sizeof(char *)*sk->num_alloc);\n\tif (s == NULL) goto err;\n\tret->data=s;\n\tret->num=sk->num;\n\tmemcpy(ret->data,sk->data,sizeof(char *)*sk->num);\n\tret->sorted=sk->sorted;\n\tret->num_alloc=sk->num_alloc;\n\tret->comp=sk->comp;\n\treturn(ret);\nerr:\n\treturn(NULL);\n\t}', '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}']