[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: stable-1.8 updated (1.7.2-20111231-72-g0b344aa)
The branch, stable-1.8 has been updated
via 0b344aaa401513c5e9b075849358805ea8cb301d (commit)
from 13664d6acc70b939668493bb43e60eeaa9c202ea (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
libgeda/src/g_rc.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
=================
Commit Messages
=================
commit 0b344aaa401513c5e9b075849358805ea8cb301d
Author: Gareth Edwards <gareth@xxxxxxxxxxxxxxxxxxxx>
Commit: Gareth Edwards <gareth@xxxxxxxxxxxxxxxxxxxx>
libgeda: fix potential memory leaks in Scheme API
Add dynamic contexts and supporting unwind handlers to
g_rc_component_library() and g_rc_component_library_command() functions.
:100644 100644 eb9eaf4... 0090b85... M libgeda/src/g_rc.c
=========
Changes
=========
commit 0b344aaa401513c5e9b075849358805ea8cb301d
Author: Gareth Edwards <gareth@xxxxxxxxxxxxxxxxxxxx>
Commit: Gareth Edwards <gareth@xxxxxxxxxxxxxxxxxxxx>
libgeda: fix potential memory leaks in Scheme API
Add dynamic contexts and supporting unwind handlers to
g_rc_component_library() and g_rc_component_library_command() functions.
diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c
index eb9eaf4..0090b85 100644
--- a/libgeda/src/g_rc.c
+++ b/libgeda/src/g_rc.c
@@ -413,16 +413,19 @@ SCM g_rc_component_library(SCM path, SCM name)
SCM_ASSERT (scm_is_string (path), path,
SCM_ARG1, "component-library");
-
+
+ scm_dynwind_begin (0);
if (name != SCM_UNDEFINED) {
SCM_ASSERT (scm_is_string (name), name,
SCM_ARG2, "component-library");
namestr = scm_to_utf8_string (name);
+ scm_dynwind_free(namestr);
}
-
+
/* take care of any shell variables */
temp = scm_to_utf8_string (path);
string = s_expand_env_variables (temp);
+ scm_dynwind_unwind_handler (g_free, string, SCM_F_WIND_EXPLICITLY);
free (temp);
/* invalid path? */
@@ -430,10 +433,7 @@ SCM g_rc_component_library(SCM path, SCM name)
fprintf(stderr,
"Invalid path [%s] passed to component-library\n",
string);
- if (namestr != NULL) {
- free (namestr);
- }
- g_free(string);
+ scm_dynwind_end();
return SCM_BOOL_F;
}
@@ -448,11 +448,7 @@ SCM g_rc_component_library(SCM path, SCM name)
g_free(cwd);
}
- if (namestr != NULL) {
- free (namestr);
- }
- g_free(string);
-
+ scm_dynwind_end();
return SCM_BOOL_T;
}
@@ -481,16 +477,20 @@ SCM g_rc_component_library_command (SCM listcmd, SCM getcmd,
SCM_ASSERT (scm_is_string (name), name, SCM_ARG3,
"component-library-command");
+ scm_dynwind_begin(0);
+
/* take care of any shell variables */
/*! \bug this may be a security risk! */
tmp_str = scm_to_utf8_string (listcmd);
lcmdstr = s_expand_env_variables (tmp_str);
+ scm_dynwind_unwind_handler (g_free, lcmdstr, SCM_F_WIND_EXPLICITLY);
free (tmp_str); /* this should stay as free (allocated from guile) */
/* take care of any shell variables */
/*! \bug this may be a security risk! */
tmp_str = scm_to_utf8_string (getcmd);
gcmdstr = s_expand_env_variables (tmp_str);
+ scm_dynwind_unwind_handler (g_free, gcmdstr, SCM_F_WIND_EXPLICITLY);
free (tmp_str); /* this should stay as free (allocated from guile) */
namestr = scm_to_utf8_string (name);
@@ -498,8 +498,8 @@ SCM g_rc_component_library_command (SCM listcmd, SCM getcmd,
src = s_clib_add_command (lcmdstr, gcmdstr, namestr);
free (namestr); /* this should stay as free (allocated from guile) */
- g_free (lcmdstr);
- g_free (gcmdstr);
+
+ scm_dynwind_end();
if (src != NULL) return SCM_BOOL_T;
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs