From 7655b6df6d81dcdcfd3483bf759a42f3741cb574 Mon Sep 17 00:00:00 2001 From: Simon Marchetto Date: Wed, 21 Aug 2013 14:35:48 +0200 Subject: [PATCH] Scilab: fix arrays_global test case --- Lib/scilab/scichar.swg | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/scilab/scichar.swg b/Lib/scilab/scichar.swg index c402dd891..96e855929 100644 --- a/Lib/scilab/scichar.swg +++ b/Lib/scilab/scichar.swg @@ -102,10 +102,6 @@ SwigScilabStringToCharPtr(void *_pvApiCtx, int _iVar, char *_pcValue, int _iLeng char* pcTmpValue = NULL; int iRet; - if (_pcValue == NULL) { - return SWIG_ERROR; - } - sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar); if (sciErr.iErr) { printError(&sciErr, 0); @@ -117,7 +113,10 @@ SwigScilabStringToCharPtr(void *_pvApiCtx, int _iVar, char *_pcValue, int _iLeng return SWIG_ERROR; } - strncpy(_pcValue, pcTmpValue, _iLength); + if (_pcValue != NULL) { + strncpy(_pcValue, pcTmpValue, _iLength); + } + free(pcTmpValue); return SWIG_OK;