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:
Vincent Couvert 2011-05-23 12:47:40 +00:00
commit d986076564

View file

@ -183,8 +183,12 @@ SwigScilabStringToCharPtrAndSize(void *_pvApiCtx, int _iVar, char **_pcValue, si
printError(&sciErr, 0);
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);