Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-583

purify reports memory leak inside rw_putenv()

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.3.0
    • Component/s: Test Driver
    • Labels:
      None
    • Severity:
      Resource Leak

      Description

      rw_putenv() uses putenv() to add variables to the environment. Unfortunately putenv() actually places the user provided string into the environment, so the string cannot be deallocated immediately. The result is false positive memory leaks in tests that use rw_putenv().

      One solution would be to use setenv() and unsetenv() on platforms that support them. This avoids the memory leak. Another option would be to have rw_putenv() track the environment strings that were added, then remove and deallocate them when the test driver is taken down.

        Attachments

        1. 0.printf.log
          11 kB
          Travis Vitek

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vitek Travis Vitek
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified