Prevent memory leak.
--HG-- branch : develop
This commit is contained in:
parent
b0348cbe9f
commit
a9367f7ae6
|
@ -16,6 +16,7 @@
|
|||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <QScopedPointer>
|
||||
#include "intern/drw_textcodec.h"
|
||||
#include "intern/dxfreader.h"
|
||||
#include "intern/dxfwriter.h"
|
||||
|
@ -2541,18 +2542,18 @@ bool dxfRW::processPolyline() {
|
|||
bool dxfRW::processVertex(DRW_Polyline *pl) {
|
||||
DRW_DBG("dxfRW::processVertex");
|
||||
int code;
|
||||
DRW_Vertex *v = new DRW_Vertex();
|
||||
QScopedPointer<DRW_Vertex> v(new DRW_Vertex());
|
||||
while (reader->readRec(&code)) {
|
||||
DRW_DBG(code); DRW_DBG("\n");
|
||||
switch (code) {
|
||||
case 0: {
|
||||
pl->appendVertex(v);
|
||||
pl->appendVertex(v.take());
|
||||
nextentity = reader->getString();
|
||||
DRW_DBG(nextentity); DRW_DBG("\n");
|
||||
if (nextentity == "SEQEND") {
|
||||
return true; //found SEQEND no more vertex, terminate
|
||||
} else if (nextentity == "VERTEX"){
|
||||
v = new DRW_Vertex(); //another vertex
|
||||
v.reset(new DRW_Vertex()); //another vertex
|
||||
}
|
||||
}
|
||||
DRW_FALLTHROUGH
|
||||
|
@ -2561,7 +2562,6 @@ bool dxfRW::processVertex(DRW_Polyline *pl) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
delete v;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user