diff options
Diffstat (limited to 'ext/wddx/wddx.c')
| -rw-r--r-- | ext/wddx/wddx.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c index 93526f56a1..22ff535c63 100644 --- a/ext/wddx/wddx.c +++ b/ext/wddx/wddx.c @@ -934,6 +934,16 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) !strcmp(name, EL_DATETIME)) { wddx_stack_top(stack, (void**)&ent1); + if (!ent1->data) { + if (stack->top > 1) { + stack->top--; + } else { + stack->done = 1; + } + efree(ent1); + return; + } + if (!strcmp(name, EL_BINARY)) { int new_len=0; unsigned char *new_str; @@ -1030,6 +1040,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name) } } else if (!strcmp(name, EL_VAR) && stack->varname) { efree(stack->varname); + stack->varname = NULL; } else if (!strcmp(name, EL_FIELD)) { st_entry *ent; wddx_stack_top(stack, (void **)&ent); @@ -1049,7 +1060,7 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) if (!wddx_stack_is_empty(stack) && !stack->done) { wddx_stack_top(stack, (void**)&ent); - switch (Z_TYPE_P(ent)) { + switch (ent->type) { case ST_STRING: if (Z_STRLEN_P(ent->data) == 0) { STR_FREE(Z_STRVAL_P(ent->data)); @@ -1088,11 +1099,11 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len) } else if (!strcmp(s, "false")) { Z_LVAL_P(ent->data) = 0; } else { - stack->top--; zval_ptr_dtor(&ent->data); - if (ent->varname) + if (ent->varname) { efree(ent->varname); - efree(ent); + } + ent->data = NULL; } break; |
