Skip to content

Commit 5b10e86

Browse files
committed
fix memory leaks with custom encoder/decoder
Change-Id: I4378fffb66ea5facc06aa16cd5383a5c2d301005 Reviewed-on: http://review.couchbase.org/c/php-couchbase/+/163453 Tested-by: Build Bot <[email protected]> Reviewed-by: Sergey Avseyev <[email protected]>
1 parent 8e173f9 commit 5b10e86

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/couchbase/bucket/get.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ PHP_METHOD(GetOptions, decoder)
134134
}
135135

136136
pcbc_update_property(pcbc_get_options_ce, getThis(), ("decoder"), arg);
137+
zval_ptr_dtor(arg);
137138
RETURN_ZVAL(getThis(), 1, 0);
138139
}
139140

src/couchbase/bucket/store.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ PHP_METHOD(InsertOptions, encoder)
134134
}
135135

136136
pcbc_update_property(pcbc_insert_options_ce, getThis(), ("encoder"), arg);
137+
zval_ptr_dtor(arg);
137138
RETURN_ZVAL(getThis(), 1, 0);
138139
}
139140

@@ -316,6 +317,7 @@ PHP_METHOD(UpsertOptions, encoder)
316317
}
317318

318319
pcbc_update_property(pcbc_upsert_options_ce, getThis(), ("encoder"), arg);
320+
zval_ptr_dtor(arg);
319321
RETURN_ZVAL(getThis(), 1, 0);
320322
}
321323

@@ -536,6 +538,7 @@ PHP_METHOD(ReplaceOptions, encoder)
536538
}
537539

538540
pcbc_update_property(pcbc_replace_options_ce, getThis(), ("encoder"), arg);
541+
zval_ptr_dtor(arg);
539542
RETURN_ZVAL(getThis(), 1, 0);
540543
}
541544

0 commit comments

Comments
 (0)