Author: billblough
Date: Thu May 17 03:20:10 2018
New Revision: 1831747
URL: http://svn.apache.org/viewvc?rev=1831747&view=rev
Log:
Fix guththila stack issues
guththila_stack_push allocates memory is chunks of stack->max or
stack->max * 2, however guththila_stack_del_top tries to free individual data
elements, leading to memory errors. Changed del_top function to remove
value from stack but not attempt to free the memory (which will be freed
when stack_un_init or stack_free is called).
Also, in guththila_stack_un_init, set stack_data = NULL after freeing, to
avoid possible double free if stack_free is inadvertently called after
stack_un_init.
Modified:
axis/axis2/c/core/trunk/guththila/src/guththila_stack.c
Modified: axis/axis2/c/core/trunk/guththila/src/guththila_stack.c
URL:
http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/guththila/src/guththila_stack.c?rev=1831747&r1=1831746&r2=1831747&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/guththila/src/guththila_stack.c (original)
+++ axis/axis2/c/core/trunk/guththila/src/guththila_stack.c Thu May 17 03:20:10
2018
@@ -50,7 +50,10 @@ guththila_stack_un_init(
const axutil_env_t * env)
{
if(stack->data)
+ {
AXIS2_FREE(env->allocator, stack->data);
+ stack->data = NULL;
+ }
}
void *GUTHTHILA_CALL
@@ -110,7 +113,7 @@ guththila_stack_del_top(
{
if(stack->top > 0)
{
- AXIS2_FREE(env->allocator, stack->data[stack->top]);
+ stack->data[stack->top--] = NULL;
return GUTHTHILA_SUCCESS;
}
return GUTHTHILA_FAILURE;