OpenDDLParser: Fix potential memory leak
parent
9dadec7736
commit
eb5f47f5c5
|
@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -275,12 +276,12 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) {
|
||||||
}
|
}
|
||||||
delete id;
|
delete id;
|
||||||
|
|
||||||
Name *name(ddl_nullptr);
|
Name *name_(ddl_nullptr);
|
||||||
in = OpenDDLParser::parseName(in, end, &name);
|
in = OpenDDLParser::parseName(in, end, &name_);
|
||||||
|
std::unique_ptr<Name> name(name_);
|
||||||
if( ddl_nullptr != name && ddl_nullptr != node ) {
|
if( ddl_nullptr != name && ddl_nullptr != node ) {
|
||||||
const std::string nodeName( name->m_id->m_buffer );
|
const std::string nodeName( name->m_id->m_buffer );
|
||||||
node->setName( nodeName );
|
node->setName( nodeName );
|
||||||
delete name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue