Changeset 81bd7e3


Ignore:
Timestamp:
Apr 18, 2023, 2:09:52 PM (19 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
a5ea261
Parents:
66b6f66
Message:

Adding explination to the memory leak in driver/cfa.cc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • driver/cfa.cc

    r66b6f66 r81bd7e3  
    4444        static int flags = 0;
    4545
     46    // This allocation 'leaks' memory from the program to the execution
     47    // environment, as putenv does not manage the storage of the string used
     48    // as an environment variable. This leak is necessary to ensure the
     49    // underlying C string is allocated long enough.
    4650        if ( putenv( (char *)( *new string( string( __CFA_FLAGPREFIX__ + to_string( flags++ ) + "__=" ) + arg ) ).c_str() ) ) {
    4751                cerr << argv[0] << " error, cannot set environment variable." << endl;
Note: See TracChangeset for help on using the changeset viewer.