r18295 - gnucash/trunk/src - Fix more valgrind problems
Phil Longstaff
plongstaff at rogers.com
Tue Sep 8 10:30:50 EDT 2009
Yes. The purpose of this call was for scm so that the returned string wouldn't be leaked. If swig could wrap a call and free the result, that would be an even better solution.
API have caller supply the data? If swig could generate a wrapper that would do that, great.
1000 limit? Seemed to be enough at the time.
Phil
________________________________
From: Derek Atkins <warlord at MIT.EDU>
To: gnucash-devel at gnucash.org
Sent: Tuesday, September 8, 2009 10:03:44 AM
Subject: Re: r18295 - gnucash/trunk/src - Fix more valgrind problems
Phil,
Phil Longstaff <plongstaff at code.gnucash.org> writes:
[snip]
> +/**
> + * Returns the account full name. Unlike xaccAccountGetFullName(), the
> + * string returned must *NOT* be freed.
> + *
> + * @param account Account
> + * @return Account full name
> + */
Moreover this function is no longer thread-safe at all, as it uses
static data. So you must be sure to copy out the results before anyone
else calls it.
Any reason not to change the API to have the caller supply the data?
Why the arbitrary 1000 char limit?
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
_______________________________________________
gnucash-devel mailing list
gnucash-devel at gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel
More information about the gnucash-devel
mailing list