[CDRIVER-4536] Replace bare malloc calls with bson_malloc Created: 12/Dec/22  Updated: 28/Oct/23  Resolved: 28/Aug/23

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.25.0

Type: Task Priority: Minor - P4
Reporter: Kyle Kloberdanz Assignee: Roberto Sanchez
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There are a few places in the C driver source code where we call `malloc` directly instead of the `bson_malloc` wrapper. We need to replace all of these calls with the `bson_malloc` wrapper. Calls to malloc can be found as follows:

 

~/src/mongo-c-driver$ grep -rn "\<malloc (" * 2> /dev/null

 

Please be sure to replace all of the allocation functions with their appropriate `bson_*` counterpart, i.e.,

  • free => bson_free
  • malloc => bson_malloc
  • calloc => bson_malloc0
  • realloc => bson_realloc


 Comments   
Comment by Githook User [ 28/Aug/23 ]

Author:

{'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com', 'username': 'rcsanchez97'}

Message: CDRIVER-4536 replace calls to malloc/calloc/free with bson wrapper equivalents
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/a8ac83fd0a17089c634642f49e84150bfe49e904

Comment by Roberto Sanchez [ 28/Aug/23 ]

https://github.com/mongodb/mongo-c-driver/pull/1390

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