From fe19947fc068557d5ec9fb0567343f7f53786b65 Mon Sep 17 00:00:00 2001 From: Joshua Sled Date: Sun, 16 Dec 2007 17:17:27 +0000 Subject: [PATCH] =?UTF-8?q?Bug#496178:=20freeing=20the=20result=20of=20gui?= =?UTF-8?q?d=5Fto=5Fstring(=E2=80=A6)=20causes=20memory=20corruption;=20us?= =?UTF-8?q?e=20guid=5Fto=5Fstring=5Fbuff(=E2=80=A6)=20for=20clarity.=20BP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16670 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/app-utils/gnc-sx-instance-model.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app-utils/gnc-sx-instance-model.c b/src/app-utils/gnc-sx-instance-model.c index c9e3285a5b..f8ea4bafc1 100644 --- a/src/app-utils/gnc-sx-instance-model.c +++ b/src/app-utils/gnc-sx-instance-model.c @@ -261,11 +261,10 @@ Account* gnc_sx_get_template_transaction_account(SchedXaction *sx) { Account *template_root, *sx_template_acct; - const char *sx_guid_str; + char sx_guid_str[GUID_ENCODING_LENGTH]; template_root = gnc_book_get_template_root(gnc_get_current_book()); - sx_guid_str = guid_to_string(xaccSchedXactionGetGUID(sx)); - /* Get account named after guid string. */ + guid_to_string_buff(xaccSchedXactionGetGUID(sx), sx_guid_str); sx_template_acct = gnc_account_lookup_by_name(template_root, sx_guid_str); return sx_template_acct; } @@ -924,13 +923,12 @@ _get_template_split_account(GncSxInstance *instance, Split *template_split, Acco *split_acct = xaccAccountLookup(acct_guid, gnc_get_current_book()); if (*split_acct == NULL) { - const char *guid_str; + char guid_str[GUID_ENCODING_LENGTH]; GString *err; - guid_str = guid_to_string((const GUID*)acct_guid); + guid_to_string_buff((const GUID*)acct_guid, guid_str); err = g_string_new(""); g_string_printf(err, "Unknown account for guid [%s], cancelling SX [%s] creation.", guid_str, xaccSchedXactionGetName(instance->parent->sx)); - g_free((char*)guid_str); g_critical("%s", err->str); if (creation_errors != NULL) *creation_errors = g_list_append(*creation_errors, err);