forked from qt-creator/qt-creator
ImageContainer: Fix potential use after free
Found during clang-analyzer run. Change-Id: I6549403ac949650058348ccc22b2020d09ef53e0 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -98,7 +98,8 @@ static SharedMemory *createSharedMemory(qint32 key, int byteCount)
|
||||
sharedMemory = new SharedMemory(QString(imageKeyTemplateString).arg(key));
|
||||
bool sharedMemoryIsCreated = sharedMemory->create(byteCount);
|
||||
if (sharedMemoryIsCreated) {
|
||||
globalSharedMemoryContainer()->insert(key, sharedMemory);
|
||||
if (!globalSharedMemoryContainer()->insert(key, sharedMemory))
|
||||
return nullptr;
|
||||
} else {
|
||||
delete sharedMemory;
|
||||
sharedMemory = nullptr;
|
||||
|
Reference in New Issue
Block a user