r20687 - gnucash/trunk/src/engine - Correct memory leak found with Valgrind.

J. Alex Aycinena alex.aycinena at code.gnucash.org
Mon May 23 18:26:35 EDT 2011


Author: alex.aycinena
Date: 2011-05-23 18:26:34 -0400 (Mon, 23 May 2011)
New Revision: 20687
Trac: http://svn.gnucash.org/trac/changeset/20687

Modified:
   gnucash/trunk/src/engine/engine-helpers.c
Log:
Correct memory leak found with Valgrind.

Modified: gnucash/trunk/src/engine/engine-helpers.c
===================================================================
--- gnucash/trunk/src/engine/engine-helpers.c	2011-05-23 19:44:24 UTC (rev 20686)
+++ gnucash/trunk/src/engine/engine-helpers.c	2011-05-23 22:26:34 UTC (rev 20687)
@@ -502,12 +502,17 @@
     while (!scm_is_null (path_scm))
     {
         SCM key_scm = SCM_CAR (path_scm);
+        char *str;
         char *key;
 
         if (!scm_is_string (key_scm))
             break;
 
-        key = g_strdup (scm_to_locale_string (key_scm));
+        scm_dynwind_begin (0); 
+        str = scm_to_locale_string(key_scm); 
+        key = g_strdup (str);
+        scm_dynwind_free (str); 
+        scm_dynwind_end (); 
 
         path = g_slist_prepend (path, key);
 



More information about the gnucash-changes mailing list