On 22-12-12 10:38, Geert Janssens wrote:
BUT... While writing all this, I noticed I glossed over a subtle
memory issue nonetheless that I have to fix again:
scm_to_locale_string uses malloc to allocate memory for the return
value. The memory should be freed using free. However gnucash is based
on glib and hence mostly deopends g_malloc to allocate memory. This
memory should be freed using g_free. That was probably the main reason
scm_to_locale_string was wrapped in the first place, which I didn't
realize.
I'll readd the function gnc_scm_to_locale_string (in a simplified
form) shortly to correct this. So once again: thanks for point this out.
I have readded a gnc_scm_to_locale_string functino and evaluated each
use of scm_to_locale_string for possible memory leaks. I think they
should all be properly handled now.
In most cases gnc_scm_to_locale_string was the proper replacement. In
the very few cases where it made sense, I kept the original
scm_to_locale_string accompanied by the proper scm_dynwind_* calls.
I also took the opportunity to improve some other guile convenience
functions. But this work is incomplete. I may add to it as I encounter
other cases where the wrapper functions make sense.
Geert
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel