[PATCH] Fix a memory leak by actually freeing a correct pointer
authorGleb Popov <6yearold@gmail.com>
Mon, 24 Feb 2025 16:24:07 +0000 (19:24 +0300)
committerAurélien COUDERC <coucouf@debian.org>
Mon, 9 Jun 2025 07:01:20 +0000 (09:01 +0200)
Gbp-Pq: Name upstream_8b4b5c86_Fix-a-memory-leak-by-actually-freeing-a-correct-pointer.patch

src/plugins/sfdisk/sfdiskbackend.cpp

index 3c4b900ba65fc602791d173c0197afd8018badba..e47c4e58b9fe2270aeedac34c64c8e0317e14032 100644 (file)
@@ -108,7 +108,7 @@ QList<Device*> SfdiskBackend::scanDevices(const ScanFlags scanFlags)
                 result.append(device);
             }
         }
-        
+
     }
 
     VolumeManagerDevice::scanDevices(result); // scan all types of VolumeManagerDevices
@@ -337,8 +337,8 @@ void SfdiskBackend::scanWholeDevicePartition(Device& d) {
     Partition *partition = scanPartition(d, partitionNode, firstSector, lastSector, QString(), false);
 
     if (partition->fileSystem().type() == FileSystem::Type::Unknown) {
-        setPartitionTableForDevice(d, nullptr);
         delete d.partitionTable();
+        setPartitionTableForDevice(d, nullptr);
     }
 
     if (!partition->roles().has(PartitionRole::Luks))