[CDRIVER-595] Remove uses of bare memory methods and ensure we don't add new ones Created: 27/Mar/15  Updated: 11/Jan/16  Resolved: 05/Aug/15

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.2-beta0

Type: Bug Priority: Major - P3
Reporter: Mira Carey Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

(Required for Phongo.)

A quick scan shows:

.h3 libbson

yajl stuff uses bare malloc/realloc/free

.h3 libmongoc

mongoc-sasl uses bare free and strdup

They need to not do that. It'd also be nice to have a way to enforce the requirement that we not call out (maybe scan object files for symbol dependencies on malloc, calloc, realloc,free?)



 Comments   
Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: Merge branch 'master' into r1.2

Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-595: Use the bson_free wrapper for copy&pastability
Branch: 1.3.0-dev
https://github.com/mongodb/libbson/commit/4a5c4c452121a73c86eeb5d4edd42c16d1f89da6

Comment by Githook User [ 22/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: Merge branch 'master' into r1.2

Comment by Githook User [ 20/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: Merge branch 'master' into r1.2

Comment by Githook User [ 20/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-595: Use the bson_free wrapper for copy&pastability
Branch: debian
https://github.com/mongodb/libbson/commit/4a5c4c452121a73c86eeb5d4edd42c16d1f89da6

Comment by Githook User [ 20/Oct/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: Merge branch 'master' into r1.2

Comment by Githook User [ 20/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-595: Use the bson_free wrapper for copy&pastability
Branch: r1.2
https://github.com/mongodb/libbson/commit/4a5c4c452121a73c86eeb5d4edd42c16d1f89da6

Comment by Githook User [ 14/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-595: Use the bson_free wrapper for copy&pastability
Branch: master
https://github.com/mongodb/libbson/commit/4a5c4c452121a73c86eeb5d4edd42c16d1f89da6

Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-595: Remove uses of bare memory methods
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/10c0421289330a0733f4ee1d35e156a871afaedc

Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-595: These are bson_free()d, so must be bson_malloc()d
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/91a651d3f37e778137519b9821745b14dc99ac17

Comment by Hannes Magnusson [ 03/Aug/15 ]

https://mongodbcr.appspot.com/13360001/
https://mongodbcr.appspot.com/12510001

Comment by Hannes Magnusson [ 03/Aug/15 ]

Correctly fixing the yajl_tree.c source to account for yajl_alloc_funcs is a little painful.
I eventually realized that we don't actually use it at all.
As the entry point is yajl_tree_parse() which should be freed with yajl_tree_free() we will atleast not attempt to bson_free() something that wasn't bson_alloc()cated. We don't expose the yajl api either.

I think its safe not to patch yajl_tree.c

I think scanning the object files for dependencies on malloc/../ is a bit excessive.

Comment by A. Jesse Jiryu Davis [ 01/Apr/15 ]

For example:

https://github.com/lloyd/yajl/blob/master/src/yajl_tree.c#L63-63

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