r22829 - gnucash/trunk/src - Fix memory leaks due to localtime -> gnc_localtime replacement in r22618, r22626, r22627
Christian Stimming
cstim at code.gnucash.org
Fri Mar 22 17:39:50 EDT 2013
Author: cstim
Date: 2013-03-22 17:39:49 -0400 (Fri, 22 Mar 2013)
New Revision: 22829
Trac: http://svn.gnucash.org/trac/changeset/22829
Modified:
gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
gnucash/trunk/src/core-utils/gnc-jalali.c
gnucash/trunk/src/register/ledger-core/split-register-model.c
Log:
Fix memory leaks due to localtime -> gnc_localtime replacement in r22618, r22626, r22627
Modified: gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c
===================================================================
--- gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c 2013-03-22 21:39:37 UTC (rev 22828)
+++ gnucash/trunk/src/business/business-ledger/gncEntryLedgerModel.c 2013-03-22 21:39:49 UTC (rev 22829)
@@ -577,7 +577,7 @@
GncEntryLedger *ledger = user_data;
BasicCell *cell;
char string[1024];
- struct tm *tm;
+ struct tm tm;
Timespec ts;
time64 tt;
@@ -590,8 +590,8 @@
gnc_date_cell_get_date ((DateCell *) cell, &ts);
tt = ts.tv_sec;
- tm = gnc_localtime (&tt);
- qof_strftime (string, sizeof(string), "%A %d %B %Y", tm);
+ gnc_localtime_r (&tt, &tm);
+ qof_strftime (string, sizeof(string), "%A %d %B %Y", &tm);
return g_strdup (string);
}
Modified: gnucash/trunk/src/core-utils/gnc-jalali.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-jalali.c 2013-03-22 21:39:37 UTC (rev 22828)
+++ gnucash/trunk/src/core-utils/gnc-jalali.c 2013-03-22 21:39:49 UTC (rev 22829)
@@ -179,15 +179,15 @@
{
int y, m, d;
time64 bin_time;
- struct tm *br_time;
+ struct tm br_time;
gnc_time (&bin_time);
- br_time = gnc_localtime (&bin_time);
+ gnc_localtime_r (&bin_time, &br_time);
gregorian_to_jalali(&y, &m, &d,
- 1900 + br_time->tm_year,
- 1 + br_time->tm_mon,
- br_time->tm_mday);
+ 1900 + br_time.tm_year,
+ 1 + br_time.tm_mon,
+ br_time.tm_mday);
printf("Current Jalali date: %d %s %d\n", d, j_month_name[m-1], y);
Modified: gnucash/trunk/src/register/ledger-core/split-register-model.c
===================================================================
--- gnucash/trunk/src/register/ledger-core/split-register-model.c 2013-03-22 21:39:37 UTC (rev 22828)
+++ gnucash/trunk/src/register/ledger-core/split-register-model.c 2013-03-22 21:39:49 UTC (rev 22829)
@@ -907,7 +907,7 @@
SplitRegister *reg = user_data;
BasicCell *cell;
char string[1024];
- struct tm *tm;
+ struct tm tm;
Timespec ts;
time64 tt;
@@ -918,9 +918,9 @@
gnc_date_cell_get_date ((DateCell *) cell, &ts);
tt = ts.tv_sec;
- tm = gnc_localtime (&tt);
+ gnc_localtime_r (&tt, &tm);
- qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
+ qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm);
return g_strdup (string);
}
More information about the gnucash-changes
mailing list