Fix to properly free memory that was allocated.

This commit is contained in:
Collin Kidder
2015-08-08 19:09:01 -04:00
parent 89da3421f9
commit f9fef43a9a
3 changed files with 51 additions and 0 deletions
+8
View File
@@ -20,7 +20,10 @@ void DBCHandler::loadDBCFile(QString filename)
qDebug() << "DBC File: " << filename;
if (!inFile->open(QIODevice::ReadOnly | QIODevice::Text))
{
delete inFile;
return;
}
qDebug() << "Starting DBC load";
dbc_nodes.clear();
@@ -256,6 +259,7 @@ void DBCHandler::loadDBCFile(QString filename)
*/
}
inFile->close();
delete inFile;
}
/*Yes, this is really hard to follow and all of the sections are mixed up in code
@@ -267,7 +271,10 @@ void DBCHandler::saveDBCFile(QString filename)
QString nodesOutput, msgOutput, commentsOutput, valuesOutput;
if (!outFile->open(QIODevice::WriteOnly | QIODevice::Text))
{
delete outFile;
return;
}
//right now it outputs a standard hard coded boilerplate
outFile->write("VERSION \"\"\n");
@@ -386,6 +393,7 @@ void DBCHandler::saveDBCFile(QString filename)
outFile->write(valuesOutput.toUtf8());
outFile->close();
delete outFile;
}