diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index 27f14bb56..65b18170d 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -43,6 +43,11 @@ SIMPLE_MAP(double, gh_scm2double, gh_double2scm, real); SIMPLE_MAP(char *, GSWIG_scm2str, gh_str02scm, string); +/* GSWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after + the function call. */ + +%typemap (guile, freearg) char * "if ($target) scm_must_free($target);"; + /* Void */ %typemap (guile, out) void "gswig_result = GH_UNSPECIFIED;";