Skip to content

Commit 9fbc609

Browse files
committed
Fix reference counting of nested bson objects
1 parent de54f80 commit 9fbc609

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bson.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ bool php_phongo_bson_visit_binary(const bson_iter_t *iter __attribute__((unused)
224224
} else {
225225
return true;
226226
}
227+
Z_SET_REFCOUNT_P(zchild, 1);
227228

228229
return false;
229230
}
@@ -254,6 +255,7 @@ bool php_phongo_bson_visit_oid(const bson_iter_t *iter __attribute__((unused)),
254255
} else {
255256
return true;
256257
}
258+
Z_SET_REFCOUNT_P(zchild, 1);
257259

258260
return false;
259261
}
@@ -290,6 +292,7 @@ bool php_phongo_bson_visit_date_time(const bson_iter_t *iter __attribute__((unus
290292
} else {
291293
return true;
292294
}
295+
Z_SET_REFCOUNT_P(zchild, 1);
293296

294297
return false;
295298
}
@@ -326,6 +329,7 @@ bool php_phongo_bson_visit_regex(const bson_iter_t *iter __attribute__((unused))
326329
} else {
327330
return true;
328331
}
332+
Z_SET_REFCOUNT_P(zchild, 1);
329333

330334
return false;
331335
}
@@ -355,6 +359,7 @@ bool php_phongo_bson_visit_code(const bson_iter_t *iter __attribute__((unused)),
355359
} else {
356360
return true;
357361
}
362+
Z_SET_REFCOUNT_P(zchild, 1);
358363

359364
return false;
360365
}
@@ -384,6 +389,7 @@ bool php_phongo_bson_visit_codewscope(const bson_iter_t *iter __attribute__((unu
384389
} else {
385390
return true;
386391
}
392+
Z_SET_REFCOUNT_P(zchild, 1);
387393

388394
return false;
389395
}
@@ -420,6 +426,7 @@ bool php_phongo_bson_visit_timestamp(const bson_iter_t *iter __attribute__((unus
420426
} else {
421427
return true;
422428
}
429+
Z_SET_REFCOUNT_P(zchild, 1);
423430

424431
return false;
425432
}
@@ -462,6 +469,7 @@ bool php_phongo_bson_visit_maxkey(const bson_iter_t *iter __attribute__((unused)
462469
} else {
463470
return true;
464471
}
472+
Z_SET_REFCOUNT_P(zchild, 1);
465473

466474
return false;
467475
}
@@ -481,6 +489,7 @@ bool php_phongo_bson_visit_minkey(const bson_iter_t *iter __attribute__((unused)
481489
} else {
482490
return true;
483491
}
492+
Z_SET_REFCOUNT_P(zchild, 1);
484493

485494
return false;
486495
}

0 commit comments

Comments
 (0)