mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix memory leak due to missing free after gnc_ctime().
Also, remove the trailing newline from the returned time string, as this is rather unexpected here. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@23183 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
b73c10b8b9
commit
d1a2d70be9
@ -1791,8 +1791,9 @@ xaccTransSetDateInternal(Transaction *trans, Timespec *dadate, Timespec val)
|
||||
{
|
||||
time64 secs = (time64) val.tv_sec;
|
||||
gchar *tstr = gnc_ctime (&secs);
|
||||
PINFO ("addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s",
|
||||
PINFO ("addr=%p set date to %" G_GUINT64_FORMAT ".%09ld %s\n",
|
||||
trans, val.tv_sec, val.tv_nsec, tstr ? tstr : "(null)");
|
||||
g_free(tstr);
|
||||
}
|
||||
|
||||
*dadate = val;
|
||||
|
@ -438,7 +438,7 @@ gchar*
|
||||
gnc_ctime (const time64 *secs)
|
||||
{
|
||||
GDateTime *gdt = gnc_g_date_time_new_from_unix_local (*secs);
|
||||
gchar *string = g_date_time_format (gdt, "%a %b %e %H:%M:%S %Y\n");
|
||||
gchar *string = g_date_time_format (gdt, "%a %b %e %H:%M:%S %Y");
|
||||
g_date_time_unref (gdt);
|
||||
return string;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ test_gnc_ctime (void)
|
||||
GDateTime *gdt = gncdt.new_from_unix_local (secs[ind]);
|
||||
gchar* datestr = gnc_ctime (&secs[ind]);
|
||||
g_assert_cmpstr (datestr, ==,
|
||||
g_date_time_format (gdt, "%a %b %e %H:%M:%S %Y\n"));
|
||||
g_date_time_format (gdt, "%a %b %e %H:%M:%S %Y"));
|
||||
g_date_time_unref (gdt);
|
||||
g_free (datestr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user