Author: pschweitzer Date: Mon Aug 1 12:05:13 2016 New Revision: 72071
URL: http://svn.reactos.org/svn/reactos?rev=72071&view=rev Log: [VFATLIB] Don't leak memory
Modified: trunk/reactos/sdk/lib/fslib/vfatlib/check/boot.c
Modified: trunk/reactos/sdk/lib/fslib/vfatlib/check/boot.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/fslib/vfatlib/check... ============================================================================== --- trunk/reactos/sdk/lib/fslib/vfatlib/check/boot.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/fslib/vfatlib/check/boot.c [iso-8859-1] Mon Aug 1 12:05:13 2016 @@ -426,16 +426,20 @@
fs->label = calloc(12, sizeof(uint8_t)); if (fs->fat_bits == 12 || fs->fat_bits == 16) { - struct boot_sector_16 *b16 = (struct boot_sector_16 *)&b; - if (b16->extended_sig == 0x29) - memmove(fs->label, b16->label, 11); - else - fs->label = NULL; + struct boot_sector_16 *b16 = (struct boot_sector_16 *)&b; + if (b16->extended_sig == 0x29) + memmove(fs->label, b16->label, 11); + else { + free(fs->label); + fs->label = NULL; + } } else if (fs->fat_bits == 32) { - if (b.extended_sig == 0x29) - memmove(fs->label, &b.label, 11); - else - fs->label = NULL; + if (b.extended_sig == 0x29) + memmove(fs->label, &b.label, 11); + else { + free(fs->label); + fs->label = NULL; + } }
if (fs->data_clusters >