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.
This commit is contained in:
John Ralls 2016-07-03 08:56:52 -07:00
parent 51e29e7836
commit a1b574af4f

View File

@ -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;
}