diff --git a/nxscript.c b/nxscript.c index 1d7375d1..f04b73df 100644 --- a/nxscript.c +++ b/nxscript.c @@ -732,12 +732,14 @@ static void putSlab(SConnection *pCon, SicsInterp *pSics, pNXScript self, hpars[haStart],hpars[haStart]+hpars[haLength],histData, hpars[haLength]*sizeof(HistInt)); } - if(histData){ - status = NXputslab(self->fileHandle, histData, start, size); - if(status == NX_OK){ - written = 1; - } + if(histData){ + status = NXputslab(self->fileHandle, histData, start, size); + if(status == NX_OK){ + written = 1; } + if (argc > 6) + free(histData); + } } /*