aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/ext/google/protobuf/encode_decode.c
diff options
context:
space:
mode:
authorGravatar Jisi Liu <liujisi@google.com>2018-02-26 10:05:09 -0800
committerGravatar GitHub <noreply@github.com>2018-02-26 10:05:09 -0800
commitbb40c0c0c4482cd97e250b24379c1b594ecc0a12 (patch)
tree139ffeb582df16a54f9f0ab5800a0793ef0e7cf7 /php/ext/google/protobuf/encode_decode.c
parenta6037c5230c0ccb6531f80cef909dbfe37257884 (diff)
parent91317c291ec819d13c83f924b39f7769fe479673 (diff)
Merge pull request #4291 from google/3.5.x
Merge 3.5.x to master
Diffstat (limited to 'php/ext/google/protobuf/encode_decode.c')
-rw-r--r--php/ext/google/protobuf/encode_decode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/php/ext/google/protobuf/encode_decode.c b/php/ext/google/protobuf/encode_decode.c
index b98121bb..a8c47f4d 100644
--- a/php/ext/google/protobuf/encode_decode.c
+++ b/php/ext/google/protobuf/encode_decode.c
@@ -484,11 +484,11 @@ static void map_slot_init(void* memory, upb_fieldtype_t type, zval* cache) {
// Store zval** in memory in order to be consistent with the layout of
// singular fields.
zval** holder = ALLOC(zval*);
+ *(zval***)memory = holder;
zval* tmp;
MAKE_STD_ZVAL(tmp);
PHP_PROTO_ZVAL_STRINGL(tmp, "", 0, 1);
*holder = tmp;
- *(zval***)memory = holder;
#else
*(zval**)memory = cache;
PHP_PROTO_ZVAL_STRINGL(*(zval**)memory, "", 0, 1);
@@ -521,7 +521,7 @@ static void map_slot_uninit(void* memory, upb_fieldtype_t type) {
case UPB_TYPE_BYTES: {
#if PHP_MAJOR_VERSION < 7
zval** holder = *(zval***)memory;
- php_proto_zval_ptr_dtor(*holder);
+ zval_ptr_dtor(holder);
FREE(holder);
#else
php_proto_zval_ptr_dtor(*(zval**)memory);
@@ -1621,6 +1621,7 @@ static void discard_unknown_fields(MessageHeader* msg) {
stringsink* unknown = DEREF(message_data(msg), 0, stringsink*);
if (unknown != NULL) {
stringsink_uninit(unknown);
+ FREE(unknown);
DEREF(message_data(msg), 0, stringsink*) = NULL;
}