Better alloc management
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12707 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
90390d80d7
commit
d986076564
1 changed files with 6 additions and 2 deletions
|
|
@ -183,8 +183,12 @@ SwigScilabStringToCharPtrAndSize(void *_pvApiCtx, int _iVar, char **_pcValue, si
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
if (_pcValue != NULL) {
|
|
||||||
*_pcValue = strdup(_pstStrings);
|
if (alloc) {
|
||||||
|
*_pcValue = %new_copy_array(_pstStrings, piLength + 1, char);
|
||||||
|
*alloc = SWIG_NEWOBJ;
|
||||||
|
} else if (_pcValue) {
|
||||||
|
*_pcValue = _pstStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(_pstStrings);
|
FREE(_pstStrings);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue