[CDRIVER-1406] scan-build warnings (mongoc) Created: 20/Jul/16  Updated: 10/Aug/16  Resolved: 05/Aug/16

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

Type: Bug Priority: Major - P3
Reporter: Hannes Magnusson Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-1348 scan-build warnings (libbson) Closed

 Description   

[2016/07/19 18:43:06.482] src/mongoc/mongoc-async.c:126:26: warning: Access to field 'expire_at' results in a dereference of a null pointer (loaded from field 'cmds')
 [2016/07/19 18:43:06.482]          timeout_msec = (async->cmds->expire_at - now) / 1000;
 [2016/07/19 18:43:06.482]                          ^~~~~~~~~~~~~~~~~~~~~~
 [2016/07/19 18:43:06.482] 1 warning generated.

 [2016/07/19 18:43:02.121] examples/bson-streaming-reader.c:173:14: warning: Potential leak of memory pointed to by 'hostname'
 [2016/07/19 18:43:02.121]       return EXIT_FAILURE;
 [2016/07/19 18:43:02.121]              ^~~~~~~~~~~~
 [2016/07/19 18:43:02.121] /usr/include/stdlib.h:133:22: note: expanded from macro 'EXIT_FAILURE'
 [2016/07/19 18:43:02.121] #define EXIT_FAILURE    1       /* Failing exit status.  */
 [2016/07/19 18:43:02.121]                         ^
 [2016/07/19 18:43:02.121] examples/bson-streaming-reader.c:173:14: warning: Potential leak of memory pointed to by 'port'
 [2016/07/19 18:43:02.121]       return EXIT_FAILURE;
 [2016/07/19 18:43:02.121]              ^~~~~~~~~~~~
 [2016/07/19 18:43:02.121] /usr/include/stdlib.h:133:22: note: expanded from macro 'EXIT_FAILURE'
 [2016/07/19 18:43:02.121] #define EXIT_FAILURE    1       /* Failing exit status.  */
 [2016/07/19 18:43:02.121]                         ^
 [2016/07/19 18:43:02.121] 2 warnings generated.

 [2016/07/19 18:43:37.413] src/mongoc/mongoc-gridfs-file.c:836:17: warning: Function call argument is an uninitialized value
 [2016/07/19 18:43:37.413]    file->page = _mongoc_gridfs_file_page_new (data, len, file->chunk_size);
 [2016/07/19 18:43:37.413]                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 [2016/07/19 18:43:37.413] 1 warning generated.

 [2016/07/19 18:44:37.844] src/mongoc/mongoc-openssl.c:319:13: warning: Value stored to 'idx' is never read
 [2016/07/19 18:44:37.844]             idx = -1;
 [2016/07/19 18:44:37.844]             ^     ~~
 [2016/07/19 18:44:37.844] 1 warning generated.

 [2016/07/19 18:46:35.956] tests/mock_server/mock-server.c:1258:7: warning: Value stored to 'r' is never read
 [2016/07/19 18:46:35.956]       r = bson_init_from_json (&doc, "{}", -1, &error);
 [2016/07/19 18:46:35.956]       ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 [2016/07/19 18:46:35.956] 1 warning generated.

 [2016/07/19 18:46:53.397] tests/test-mongoc-metadata.c:75:4: warning: Value stored to 'pool' is never read
 [2016/07/19 18:46:53.397]    pool = mongoc_client_pool_new (uri);
 [2016/07/19 18:46:53.397]    ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 [2016/07/19 18:46:53.397] 1 warning generated.

See https://s3.amazonaws.com/mciuploads/mongo-c-driver/clang38/f952591a1aaecd0a554521900ed183fae14db8e3/578ec27d3ff1221c8e00146a/mongo_c_driver_clang38_f952591a1aaecd0a554521900ed183fae14db8e3_16_07_20_00_16_28/artifacts/scan.tar.gz for html generated reports



 Comments   
Comment by A. Jesse Jiryu Davis [ 05/Aug/16 ]

Fixed - I've removed the new MONGOC_ERROR message. It turns out that if DNS resolution fails on the initial hostlist, you can correctly enter mongoc_async_run with no async commands to run.

Comment by Githook User [ 05/Aug/16 ]

Author:

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

Message: CDRIVER-1406 remove new err msg from mongoc_async_run
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/aeb423474db0c7fcb0a2c9a22de441b24f8b7054

Comment by Hannes Magnusson [ 05/Aug/16 ]

This causes a lot lot of

[2016/08/04 20:14:00.976] 2016/08/05 03:14:00.0976: [28225]:    ERROR:        async: No async commands to run!

in [2016/08/04 20:14:00.963] Begin /server_selection/errors/dns/direct/pooled

https://evergreen.mongodb.com/task_log_raw/mongo_c_driver_ubuntu_1404_64_integration_test_2.4_shard_multi_adf3a9a1ae2cd220cbae36cd524056c1f20fb15f_16_08_05_01_01_55/0?type=T&text=true

Comment by Githook User [ 05/Aug/16 ]

Author:

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

Message: CDRIVER-1406 clang warnings
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/adf3a9a1ae2cd220cbae36cd524056c1f20fb15f

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