This commit is contained in:
zolliker
2006-03-24 08:13:02 +00:00
parent 1f58256f31
commit 3d5843f0d3

View File

@ -411,14 +411,14 @@ static int printObjectPar(SConnection *pCon,SicsInterp *pSics, char *obj){
SCWrite(pCon,"ERROR: failed to open tmpfile",eError); SCWrite(pCon,"ERROR: failed to open tmpfile",eError);
return 0; return 0;
} }
buffer = (char *)malloc(length*sizeof(char)); buffer = malloc(length+1);
if(buffer == NULL){ if(buffer == NULL){
SCWrite(pCon,"ERROR: out of memory in list par",eError); SCWrite(pCon,"ERROR: out of memory in list par",eError);
fclose(fd); fclose(fd);
unlink(tmpfile); unlink(tmpfile);
return 0; return 0;
} }
memset(buffer,0,length*sizeof(char)); memset(buffer,0,length+1);
fread(buffer,length,1,fd); fread(buffer,length,1,fd);
fclose(fd); fclose(fd);
SCWrite(pCon,buffer,eValue); SCWrite(pCon,buffer,eValue);