[CDRIVER-2696] examples leaking memory in most cases Created: 13/Jun/18  Updated: 09/Feb/23

Status: Backlog
Project: C Driver
Component/s: Docs Examples, libmongoc
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Evgeni Dobranov Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Most examples in src/libmongoc/examples (e.g. examples/find-and-modify.c) exit before freeing initialized variables in the case of failure. A select few other examples (e.g. examples/example-session.c and examples/basic_aggregation/basic-aggregation.c) use a goto label and free all memory before exiting.

Should all examples be adapted to use a goto label? This would likely require quite a bit of refactoring for the ~20-25 examples in the directory that don't use a label.


Generated at Wed Feb 07 21:16:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.