Commit b3ee8302 authored by Pavel Vainerman's avatar Pavel Vainerman

fixed bug in allocate memory

parent 8f3607b6
...@@ -59,7 +59,7 @@ std::vector<lsampl_t> ComediInterface::getAnalogPacket( int subdev, int channel, ...@@ -59,7 +59,7 @@ std::vector<lsampl_t> ComediInterface::getAnalogPacket( int subdev, int channel,
int ret = comedi_do_insn(card, &insn); int ret = comedi_do_insn(card, &insn);
if( ret < 0 ) if( ret < 0 )
{ {
delete data; delete[] data;
ostringstream err; ostringstream err;
err << "(ComediInterface:getAnalogPacket): can`t read data from subdev=" << subdev err << "(ComediInterface:getAnalogPacket): can`t read data from subdev=" << subdev
...@@ -73,7 +73,7 @@ std::vector<lsampl_t> ComediInterface::getAnalogPacket( int subdev, int channel, ...@@ -73,7 +73,7 @@ std::vector<lsampl_t> ComediInterface::getAnalogPacket( int subdev, int channel,
if(ret > 0) if(ret > 0)
memcpy(&result[0], data, ret * sizeof(lsampl_t)); memcpy(&result[0], data, ret * sizeof(lsampl_t));
delete data; delete[] data;
return result; return result;
} }
...@@ -132,7 +132,6 @@ void ComediInterface::instrChannel( int subdev, int channel, const std::string i ...@@ -132,7 +132,6 @@ void ComediInterface::instrChannel( int subdev, int channel, const std::string i
err << "(ComediInterface:instrChannel): unknown instruction " err << "(ComediInterface:instrChannel): unknown instruction "
<< " subdev=" << subdev << " channel=" << channel << " instruction=" << instr; << " subdev=" << subdev << " channel=" << channel << " instruction=" << instr;
throw Exception(err.str()); throw Exception(err.str());
return;
} }
args.insert(args.begin(), ins); args.insert(args.begin(), ins);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment