From: Sascha Schumann Date: Wed, 6 Mar 2002 12:34:47 +0000 (+0000) Subject: Do the estrdups after checking for parameter constraints. X-Git-Tag: php-4.2.0RC1~92 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5660126d0b134b053187512dbe52895be33170f;p=php Do the estrdups after checking for parameter constraints. No real memory leaks though, because they are catched by the memory manager. --- diff --git a/ext/session/session.c b/ext/session/session.c index 09e48c2c6a..e94ab967aa 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1046,10 +1046,10 @@ PHP_FUNCTION(session_name) int ac = ZEND_NUM_ARGS(); char *old; - old = estrdup(PS(session_name)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; + + old = estrdup(PS(session_name)); if (ac == 1) { convert_to_string_ex(p_name); @@ -1068,10 +1068,10 @@ PHP_FUNCTION(session_module_name) int ac = ZEND_NUM_ARGS(); char *old; - old = safe_estrdup(PS(mod)->name); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; + + old = safe_estrdup(PS(mod)->name); if (ac == 1) { ps_module *tempmod; @@ -1132,10 +1132,10 @@ PHP_FUNCTION(session_save_path) int ac = ZEND_NUM_ARGS(); char *old; - old = estrdup(PS(save_path)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; + + old = estrdup(PS(save_path)); if (ac == 1) { convert_to_string_ex(p_name); @@ -1154,12 +1154,12 @@ PHP_FUNCTION(session_id) int ac = ZEND_NUM_ARGS(); char *old = empty_string; - if (PS(id)) - old = estrdup(PS(id)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_name) == FAILURE) WRONG_PARAM_COUNT; + if (PS(id)) + old = estrdup(PS(id)); + if (ac == 1) { convert_to_string_ex(p_name); if (PS(id)) efree(PS(id)); @@ -1178,10 +1178,10 @@ PHP_FUNCTION(session_cache_limiter) int ac = ZEND_NUM_ARGS(); char *old; - old = estrdup(PS(cache_limiter)); - if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_limiter) == FAILURE) WRONG_PARAM_COUNT; + + old = estrdup(PS(cache_limiter)); if (ac == 1) { convert_to_string_ex(p_cache_limiter);