Feeder: more efficient solution to memory leak fix

The for loop copies newly created objects into the vector and destroys the original objects. The resize() instantiates the objects directly in the vector. Suggested by Nicolás Alvarez.
This commit is contained in:
Christian Beer 2015-11-10 08:29:19 +01:00
parent 770fbf138f
commit 4eec734bc4
1 changed files with 1 additions and 5 deletions

View File

@ -560,11 +560,7 @@ void feeder_loop() {
// may need one enumeration per app; create vector
//
for (int i=0; i<napps; i++) {
DB_WORK_ITEM* wi = new DB_WORK_ITEM();
work_items.push_back(*wi);
delete wi;
}
work_items.resize(napps);
while (1) {
bool action;