gnucash maint: Clear the GDate before use.
John Ralls
jralls at code.gnucash.org
Sun Jul 3 12:07:33 EDT 2016
Updated via https://github.com/Gnucash/gnucash/commit/a1b574af (commit)
from https://github.com/Gnucash/gnucash/commit/51e29e78 (commit)
commit a1b574af4f2d2357808534e8c3d6e3b83966d658
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Jul 3 08:56:52 2016 -0700
Clear the GDate before use.
If the transaction doesn't have the gdate-posted slot and the random
junk left on the stack where date lives happens to make a valid gdate
then timespec_to_gdate won't be called and a bogus date will be returned.
diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c
index 0e2a4fc..9547eb3 100644
--- a/src/engine/Transaction.c
+++ b/src/engine/Transaction.c
@@ -2248,6 +2248,7 @@ GDate
xaccTransGetDatePostedGDate (const Transaction *trans)
{
GDate result;
+ g_date_clear (&result, 1);
if (trans)
{
/* Can we look up this value in the kvp slot? If yes, use it
@@ -2260,10 +2261,6 @@ xaccTransGetDatePostedGDate (const Transaction *trans)
else
result = timespec_to_gdate(xaccTransRetDatePostedTS(trans));
}
- else
- {
- g_date_clear(&result, 1);
- }
return result;
}
Summary of changes:
src/engine/Transaction.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
More information about the gnucash-changes
mailing list