php_phongo_bson_to_json() does not free intermediary result string

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.16.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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:
            Jeremy Mikola
            Reporter:
            Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: