diff options
| author | Sascha Schumann <sas@php.net> | 2002-03-06 12:34:47 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 2002-03-06 12:34:47 +0000 |
| commit | b5660126d0b134b053187512dbe52895be33170f (patch) | |
| tree | 8ebf862f8c960ab11ba2924f205ede3c9c1cb027 | |
| parent | 0c69739feb56ed293ef23c246ef95cd87cd39a77 (diff) | |
| download | php-git-b5660126d0b134b053187512dbe52895be33170f.tar.gz | |
Do the estrdups after checking for parameter constraints.
No real memory leaks though, because they are catched by the
memory manager.
| -rw-r--r-- | ext/session/session.c | 22 |
1 files changed, 11 insertions, 11 deletions
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); |
