Useless use of delete, causing SEGFAULT because base64length is on the stack not heap. Fixes T85

This commit is contained in:
Markus Rosenstihl 2018-03-19 21:09:10 +01:00
parent 59571b566d
commit 3f878d9746

View File

@ -614,9 +614,10 @@ int xml_result_writer::write_adcdata_formated(FILE* out, const std::string& form
int xml_result_writer::write_adcdata_base64(FILE* out, const adc_result* res) const { int xml_result_writer::write_adcdata_base64(FILE* out, const adc_result* res) const {
fprintf(out,"<adcdata samples=\"%" SIZETPRINTFLETTER "\" rate=\"%g\" channels=\"%i\">\n",res->samples,res->sampling_frequency, res->nchannels); fprintf(out,"<adcdata samples=\"%" SIZETPRINTFLETTER "\" rate=\"%g\" channels=\"%i\">\n",res->samples,res->sampling_frequency, res->nchannels);
unsigned int base64length=0; unsigned int base64length=0;
XMLByte* base64buffer=xercesc::Base64::encode( reinterpret_cast<XMLByte*>(res->data),res->samples*res->nchannels*sizeof(short int),reinterpret_cast<XMLSize_t*>(&base64length)); XMLByte* base64buffer=xercesc::Base64::encode( reinterpret_cast<XMLByte*>(res->data),
res->samples*res->nchannels*sizeof(short int),
reinterpret_cast<XMLSize_t*>(&base64length) );
fwrite(base64buffer,1,base64length,out); fwrite(base64buffer,1,base64length,out);
delete(base64buffer);
fprintf(out,"</adcdata>\n"); fprintf(out,"</adcdata>\n");
return 0; return 0;
} }