Prevent memory leaks in the case of earlier return

from wrapper methods using const std::string & parameters. Modified
Mark Traudt patch #951565.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6084 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-08-12 20:57:08 +00:00
commit 98feab7822

View file

@ -45,9 +45,9 @@ class string;
%typemap(in) const string &
%{ if (!$input) SWIG_CSharpThrowException(SWIG_CSharpNullReferenceException, "null string");
$1 = new std::string($input); %}
std::string $1_str($input);
$1 = &$1_str; %}
%typemap(out) const string & %{ $result = SWIG_csharp_string_callback($1->c_str()); %}
%typemap(freearg) const string & %{ delete $1; %}
%typemap(csin) const string & "$csinput"
%typemap(csout) const string & {