Skip to content

Commit 594b56d

Browse files
committed
fix memory leak in SearchOptions
Change-Id: I4419cd6436f1e0ded7239646d6e4d56365832a39 Reviewed-on: http://review.couchbase.org/c/php-couchbase/+/143910 Tested-by: Build Bot <[email protected]> Reviewed-by: Sergey Avseyev <[email protected]>
1 parent 7bf084c commit 594b56d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/couchbase/bucket/cbft.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ PHP_METHOD(Cluster, searchQuery)
270270
PCBC_STRING(fname, "jsonSerialize");
271271
rv = call_user_function(EG(function_table), options, &fname, &options_payload, 0, NULL);
272272
if (rv != FAILURE && !EG(exception) && !Z_ISUNDEF(options_payload)) {
273-
zend_hash_merge(HASH_OF(&payload), HASH_OF(&options_payload), NULL, 0);
273+
zend_hash_merge(HASH_OF(&payload), HASH_OF(&options_payload), zval_add_ref, 0);
274274
}
275275
zval_dtor(&fname);
276276
}
@@ -285,6 +285,7 @@ PHP_METHOD(Cluster, searchQuery)
285285
int last_error;
286286
PCBC_JSON_ENCODE(&buf, &payload, 0, last_error);
287287
zval_dtor(&payload);
288+
zval_dtor(&options_payload);
288289
if (last_error != 0) {
289290
pcbc_log(LOGARGS(cluster->conn->lcb, WARN), "Failed to encode FTS query as JSON: json_last_error=%d",
290291
last_error);

0 commit comments

Comments
 (0)