diff options
author | Bo Yang <teboring@google.com> | 2017-12-04 12:32:10 -0800 |
---|---|---|
committer | Bo Yang <teboring@google.com> | 2017-12-06 10:37:53 -0800 |
commit | 7d3437152ad420d4382b883f0a52a86526166ef5 (patch) | |
tree | f85dbaf6fb886ee8caf48c4246cad28dc78afd9c /php/ext | |
parent | e0d3aa057b89540cf83de6639a86d1ddb7199315 (diff) | |
download | protobuf-7d3437152ad420d4382b883f0a52a86526166ef5.tar.gz protobuf-7d3437152ad420d4382b883f0a52a86526166ef5.tar.bz2 protobuf-7d3437152ad420d4382b883f0a52a86526166ef5.zip |
Fix memory leak when creating map field via array.
Diffstat (limited to 'php/ext')
-rw-r--r-- | php/ext/google/protobuf/type_check.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/php/ext/google/protobuf/type_check.c b/php/ext/google/protobuf/type_check.c index 50e0f8c1..37171426 100644 --- a/php/ext/google/protobuf/type_check.c +++ b/php/ext/google/protobuf/type_check.c @@ -534,8 +534,7 @@ void check_map_field(const zend_class_entry* klass, PHP_PROTO_LONG key_type, CACHED_PTR_TO_ZVAL_PTR((CACHED_VALUE*)value) TSRMLS_CC); } - Z_DELREF_P(CACHED_TO_ZVAL_PTR(map_field)); - RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 0); + RETURN_ZVAL(CACHED_TO_ZVAL_PTR(map_field), 1, 1); } else if (Z_TYPE_P(val) == IS_OBJECT) { if (!instanceof_function(Z_OBJCE_P(val), map_field_type TSRMLS_CC)) { zend_error(E_USER_ERROR, "Given value is not an instance of %s.", |