Skip to content

Commit

Permalink
fix bad free of array
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart12 committed Sep 2, 2011
1 parent 5f0da21 commit 061c71b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fix Segmentation fault when there are no transactions

reading just gives -1 rather than an error when missing fields in the accounts file
2 changes: 1 addition & 1 deletion src/entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Entry::modify()
void
Entry::description(char const * s)
{
delete _description;
delete [] _description;
_description = strcpy(new char[(strlen(s) + 1)], s);
modify();
}
2 changes: 1 addition & 1 deletion src/entry.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Entry
friend class Transactions;
Month * _current_month;
Entry(int day, int month, int year, int f, int t, int a, char const * des);
~Entry() { delete _description; }
~Entry() { delete [] _description; }
Entry(istream & in);
void save(ostream & out) const;
void modify();
Expand Down

0 comments on commit 061c71b

Please sign in to comment.