diff options
author | Dmitry Stogov <dmitry@php.net> | 2010-05-13 08:34:06 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2010-05-13 08:34:06 +0000 |
commit | fdfdb1480e81fe12402efc0480512982f40aacf2 (patch) | |
tree | 19407e6d1ed339fb1bc7147d4751251f5fa326b4 /ext/sysvshm | |
parent | f5ef32e7ab9d5c2b3c52b5225c5bdc360171b3f8 (diff) | |
download | php-git-fdfdb1480e81fe12402efc0480512982f40aacf2.tar.gz |
Fixed a possible resource destruction issues in shm_put_var()
Diffstat (limited to 'ext/sysvshm')
-rw-r--r-- | ext/sysvshm/sysvshm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c index 520b7b798e..a66d85e4c3 100644 --- a/ext/sysvshm/sysvshm.c +++ b/ext/sysvshm/sysvshm.c @@ -251,13 +251,18 @@ PHP_FUNCTION(shm_put_var) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &shm_id, &shm_key, &arg_var)) { return; } - SHM_FETCH_RESOURCE(shm_list_ptr, shm_id); /* setup string-variable and serialize */ PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&shm_var, &arg_var, &var_hash TSRMLS_CC); PHP_VAR_SERIALIZE_DESTROY(var_hash); + shm_list_ptr = zend_fetch_resource(&shm_id TSRMLS_CC, -1, PHP_SHM_RSRC_NAME, NULL, 1, php_sysvshm.le_shm); + if (!shm_list_ptr) { + smart_str_free(&shm_var); + RETURN_FALSE; + } + /* insert serialized variable into shared memory */ ret = php_put_shm_data(shm_list_ptr->ptr, shm_key, shm_var.c, shm_var.len); |