Changeset 4bdb7bf for libcfa


Ignore:
Timestamp:
Aug 31, 2021, 1:49:10 AM (3 years ago)
Author:
Jacob Prud'homme <jafprudhomme@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
cac1d52
Parents:
5241ec2
git-author:
Jacob Prud'homme <jafprudhomme@…> (08/06/21 03:03:42)
git-committer:
Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:10)
Message:

Fixed some issues with unfreed memory

Was calling destructor on contents of pointer, without freeing actual data allocated at pointer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/parseconfig.cfa

    r5241ec2 r4bdb7bf  
    9191                } // for
    9292        } catch( Open_Failure * ex; ex->istream == &in ) {
    93                 ^(*kv_pairs){};
     93                delete( kv_pairs );
    9494                exit | "Error: could not open input file '" | config_file | "'";
    9595                // HERE (unfreed storage)
     
    124124                                // Validate the parsed data, if necessary
    125125                                if ( entries[j].validate != (bool (*)(void *))0p ) {
    126                                         if ( !entries[j].validate( entries[j].variable ) ) throw (Validation_Failure){ entries[j] }; // HERE (segfaults on throw)
     126                                        if ( !entries[j].validate( entries[j].variable ) ) {
     127                                                delete( kv_pairs );
     128                                                throw (Validation_Failure){ entries[j] };
     129                                        }
    127130                                }
    128131
     
    134137        }
    135138
    136         ^(*kv_pairs){};
    137         // HERE (unfreed storage)
     139        delete( kv_pairs );
    138140} // processConfigFile
    139141
Note: See TracChangeset for help on using the changeset viewer.