aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-12-13 07:50:49 +0100
committerLaurent Montel <[email protected]>2018-12-13 07:51:01 +0100
commit1fb6f48f2bd62dea8724b6b3eba2b33fa0132f10 (patch)
treec05465769f99577cab768327da472a9bfce3ac7b
parent227b5ff35fc630b00f275959eaa791f4880c11ab (diff)
Fix mem leak found by asan
-rw-r--r--src/core/resourcemanager.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/resourcemanager.cpp b/src/core/resourcemanager.cpp
index 07226cd..f348f27 100644
--- a/src/core/resourcemanager.cpp
+++ b/src/core/resourcemanager.cpp
@@ -362,12 +362,14 @@ CourseResource * ResourceManager::addCourse(const QUrl &courseFile)
{
CourseResource *resource = new CourseResource(this, courseFile);
if (resource->language().isEmpty()) {
+ delete resource;
qCritical() << "Could not load course, language unknown:" << courseFile.toLocalFile();
return nullptr;
}
// skip already loaded resources
if (m_loadedResources.contains(courseFile.toLocalFile())) {
+ delete resource;
return nullptr;
}
m_loadedResources.append(courseFile.toLocalFile());