[FFS] Don't leak memory on volume mount
authorPierre Schweitzer <pierre@reactos.org>
Mon, 23 Oct 2017 08:25:40 +0000 (10:25 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 23 Oct 2017 08:35:21 +0000 (10:35 +0200)
CID 1363583

drivers/filesystems/ffs/src/fsctl.c

index 251ea88..175b325 100644 (file)
@@ -183,6 +183,9 @@ FFSLoadDiskLabel(
                 Vcb->FSOffset[0] = 0;
                 Vcb->PartitionNumber = 0;
                                Vcb->ffs_super_block = FFSSb;
+#ifdef __REACTOS__
+                ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
                                Status = STATUS_SUCCESS;
                 return Status;
                        }
@@ -202,12 +205,18 @@ FFSLoadDiskLabel(
                 Vcb->FSOffset[0] = 0;
                 Vcb->PartitionNumber = 0;
                                Vcb->ffs_super_block = FFSSb;
+#ifdef __REACTOS__
+                ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
                                Status = STATUS_SUCCESS;
                 return Status;
                        }
             else
             {
                 KdPrint(("FFSLoadDiskLabel() No BSD file system was found on the \"normal\" partition.\n"));
+#ifdef __REACTOS__
+                ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
                 Status = STATUS_UNRECOGNIZED_VOLUME;
                 return Status;
             }
@@ -217,6 +226,9 @@ FFSLoadDiskLabel(
        if (!NT_SUCCESS(Status))
        {
                KdPrint(("FFSLoadDiskLabel() Slice info failed, Status %u\n", Status));
+#ifdef __REACTOS__
+        ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
                return Status;
        }
 
@@ -303,6 +315,10 @@ FFSLoadDiskLabel(
        if (Vcb->ffs_super_block == NULL)
                Status = STATUS_UNRECOGNIZED_VOLUME;
 
+#ifdef __REACTOS__
+    ExFreePoolWithTag(Disklabel, FFS_POOL_TAG);
+#endif
+
        return Status;
 }