[gnc-date.cpp] don't alloc tm* unless GncDateTime() succeeds

because GncDateTime() may throw an exception, in which case time will
leak. mainly leaks in test suite.
pull/1771/head
Christopher Lam 3 years ago
parent 5a03d9798c
commit a8dffb8559

@ -187,8 +187,8 @@ gnc_gmtime (const time64 *secs)
{
try
{
auto time = static_cast<struct tm*>(calloc(1, sizeof(struct tm)));
GncDateTime gncdt(*secs);
auto time = static_cast<struct tm*>(calloc(1, sizeof(struct tm)));
*time = gncdt.utc_tm();
return time;
}

Loading…
Cancel
Save