Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2452

Coverity analysis defect 102207: Resource leak

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 1.10.0
    • None
    • None
    • None
    • Fully Compatible

    Description

      Leak of memory or pointers to system resources

      Defect 102207 (STATIC_C)
      Checker RESOURCE_LEAK (subcategory none)
      File: /src/mongoc/mongoc-write-command.c
      Function _mongoc_write_opquery
      /src/mongoc/mongoc-write-command.c, line: 678
      Assigning: "reader" = storage returned from "bson_reader_new_from_data(command->payload.data + data_offset, command->payload.len - data_offset)".

             reader = bson_reader_new_from_data (command->payload.data + data_offset,

      /src/mongoc/mongoc-write-command.c, line: 686
      Assigning: "bson" = storage returned from "bson_reader_read(reader, &eof)".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 686
      Passing "reader" as argument 1 to function "bson_reader_read", which returns an offset off that argument.

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 686
      Resource "reader" is not freed or pointed-to in "bson_reader_read".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 686
      Assigning: "bson" = storage returned from "bson_reader_read(reader, &eof)".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 698
      Resource "bson" is not freed or pointed-to in "bson_append_document".

                BSON_APPEND_DOCUMENT (&ar, key, bson);

      /src/mongoc/mongoc-write-command.c, line: 686
      Passing "reader" as argument 1 to function "bson_reader_read", which returns an offset off that argument.

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 686
      Resource "reader" is not freed or pointed-to in "bson_reader_read".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 686
      Assigning: "bson" = storage returned from "bson_reader_read(reader, &eof)".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 725
      Variable "bson" going out of scope leaks the storage it points to.

                   EXIT;

      /src/mongoc/mongoc-write-command.c, line: 725
      Variable "reader" going out of scope leaks the storage it points to.

                   EXIT;

      File: /src/mongoc/mongoc-write-command.c
      Function _mongoc_write_opquery
      /src/mongoc/mongoc-write-command.c, line: 678
      Assigning: "reader" = storage returned from "bson_reader_new_from_data(command->payload.data + data_offset, command->payload.len - data_offset)".

             reader = bson_reader_new_from_data (command->payload.data + data_offset,

      /src/mongoc/mongoc-write-command.c, line: 686
      Assigning: "bson" = storage returned from "bson_reader_read(reader, &eof)".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 686
      Resource "reader" is not freed or pointed-to in "bson_reader_read".

             while ((bson = bson_reader_read (reader, &eof))) {

      /src/mongoc/mongoc-write-command.c, line: 725
      Variable "reader" going out of scope leaks the storage it points to.

                   EXIT;

      Attachments

        Activity

          People

            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: