Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-2211

php_phongo_bson_to_json() does not free intermediary result string

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.16.0
    • Affects Version/s: None
    • Component/s: None
    • None

      While investigating PHPC-2210 I came across several leaks in the JSON output tests for MongoDB\BSON\Document. These appear to be caused by a missing bson_free() in php_phongo_bson_to_json().

      TEST_PHP_ARGS=-m make test TESTS=tests/bson/bson-document-to*JSON-???.phpt
      
      =====================================================================
      LEAKED TEST SUMMARY
      ---------------------------------------------------------------------
      MongoDB\BSON\Document::toCanonicalExtendedJSON(): Encoding JSON [tests/bson/bson-document-toCanonicalJSON-001.phpt]
      MongoDB\BSON\Document::toCanonicalExtendedJSON(): Encoding extended JSON types [tests/bson/bson-document-toCanonicalJSON-002.phpt]
      MongoDB\BSON\Document::toRelaxedExtendedJSON(): Encoding JSON [tests/bson/bson-document-toRelaxedJSON-001.phpt]
      MongoDB\BSON\Document::toRelaxedExtendedJSON(): Encoding extended JSON types [tests/bson/bson-document-toRelaxedJSON-002.phpt]
      =====================================================================
      

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: