Skip to contentSkip to conversation

Memleak in Windows Logical Disk Manager partition handler

PATCH Oleg Drokin 1 participant 1 message Mar 9, 2003

lore
Share & tools
lore
#0 lore raw

Hello!

Not freeing allocated memory on error exit path. See the patch.
Should apply to both 2.4 and 2.5.
Found with help of smatch + enhanced unfree script.

Bye,
Oleg

===== fs/partitions/ldm.c 1.6 vs edited =====

fs/partitions/ldm.c +3 -1
@@ -1223,8 +1223,10 @@
 		return FALSE;
 	}
 
-	if (!ldm_parse_vblk (data, len, vb))
+	if (!ldm_parse_vblk (data, len, vb)) {
+		kfree(vb);
 		return FALSE;			/* Already logged */
+	}
 
 	/* Put vblk into the correct list. */
 	switch (vb->type) {