Fixed segfault if empty POST

This commit is contained in:
Xinchen Hui 2014-07-03 23:58:21 +08:00
parent 96e3fd4c1d
commit 21ccbbad7d

View file

@ -328,9 +328,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
smart_str_appendl(&post_data.str, buf, len); smart_str_appendl(&post_data.str, buf, len);
if (SUCCESS != add_post_vars(arr, &post_data, 0 TSRMLS_CC)) { if (SUCCESS != add_post_vars(arr, &post_data, 0 TSRMLS_CC)) {
if (post_data.str.s) { smart_str_free(&post_data.str);
smart_str_free(&post_data.str);
}
return; return;
} }
} }
@ -340,8 +338,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(php_std_post_handler)
} }
} }
add_post_vars(arr, &post_data, 1 TSRMLS_CC);
if (post_data.str.s) { if (post_data.str.s) {
add_post_vars(arr, &post_data, 1 TSRMLS_CC);
smart_str_free(&post_data.str); smart_str_free(&post_data.str);
} }
} }