fix memory leak in xml_result
This commit is contained in:
parent
ecfd71bd5d
commit
6e17b8b08e
@ -612,12 +612,15 @@ 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 {
|
||||
xercesc::XMLPlatformUtils::Initialize();
|
||||
fprintf(out,"<adcdata samples=\"%" SIZETPRINTFLETTER "\" rate=\"%g\" channels=\"%i\">\n",res->samples,res->sampling_frequency, res->nchannels);
|
||||
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) );
|
||||
reinterpret_cast<XMLSize_t*>(&base64length),
|
||||
xercesc::XMLPlatformUtils::fgMemoryManager );
|
||||
fwrite(base64buffer,1,base64length,out);
|
||||
fprintf(out,"</adcdata>\n");
|
||||
xercesc::XMLPlatformUtils::fgMemoryManager->deallocate(base64buffer);
|
||||
return 0;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ void PTS::phase_add_ttls(state& the_state, double p) const {
|
||||
std::vector<ttlout>::const_iterator mask=ttl_masks.begin();
|
||||
while (mask!=ttl_masks.end()) {
|
||||
/* obeye negative logic */
|
||||
if ((binary_code & 1<<11)==0 ^ negative_logic==0) the_state.push_back(mask->copy_new());
|
||||
if ( ((binary_code & 1<<11)==0) ^ (negative_logic==0)) the_state.push_back(mask->copy_new());
|
||||
binary_code<<=1;
|
||||
binary_code&=0xFFF;
|
||||
++mask;
|
||||
|
Loading…
Reference in New Issue
Block a user