fix memory leak problem
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12134 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e16a959732
commit
2233f73dd4
1 changed files with 15 additions and 3 deletions
|
|
@ -24,6 +24,14 @@
|
||||||
$3=(int*)malloc(sizeof(int));
|
$3=(int*)malloc(sizeof(int));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typemap(freearg) (double** matrixAsArgOutput,int* rows, int* cols)
|
||||||
|
{
|
||||||
|
free(*$1);
|
||||||
|
free($1);
|
||||||
|
free($2);
|
||||||
|
free($3);
|
||||||
|
}
|
||||||
|
|
||||||
%typemap(argout) (double** matrixAsArgOutput,int* rows, int* cols)
|
%typemap(argout) (double** matrixAsArgOutput,int* rows, int* cols)
|
||||||
{
|
{
|
||||||
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, *$2, *$3, (double *)*$1);
|
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, *$2, *$3, (double *)*$1);
|
||||||
|
|
@ -31,8 +39,12 @@
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LhsVar(iOutNum) = iVarOut;
|
LhsVar(iOutNum) = iVarOut;
|
||||||
iOutNum++;
|
iOutNum++;
|
||||||
iVarOut++;
|
iVarOut++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue