summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fat.c7
-rw-r--r--src/hpfs.c12
2 files changed, 13 insertions, 6 deletions
diff --git a/src/fat.c b/src/fat.c
index 34674bb..f1f3a65 100644
--- a/src/fat.c
+++ b/src/fat.c
@@ -910,11 +910,12 @@ static int fat32_set_part_name(disk_t *disk_car, partition_t *partition, const s
int check_OS2MB(disk_t *disk, partition_t *partition, const int verbose)
{
- unsigned char buffer[disk->sector_size];
- if((unsigned)disk->pread(disk, &buffer, disk->sector_size, partition->part_offset) != disk->sector_size)
+ unsigned char *buffer=(unsigned char *)MALLOC(disk->sector_size);
+ if((unsigned)disk->pread(disk, buffer, disk->sector_size, partition->part_offset) != disk->sector_size)
{
screen_buffer_add("check_OS2MB: Read error\n");
log_error("check_OS2MB: Read error\n");
+ free(buffer);
return 1;
}
if(test_OS2MB(disk,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0)
@@ -924,9 +925,11 @@ int check_OS2MB(disk_t *disk, partition_t *partition, const int verbose)
log_info("\n\ntest_OS2MB()\n");
log_partition(disk, partition);
}
+ free(buffer);
return 1;
}
partition->upart_type=UP_OS2MB;
+ free(buffer);
return 0;
}
diff --git a/src/hpfs.c b/src/hpfs.c
index 093cdbd..8524491 100644
--- a/src/hpfs.c
+++ b/src/hpfs.c
@@ -28,6 +28,9 @@
#ifdef HAVE_STRING_H
#include <string.h>
#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h> /* free */
+#endif
#include "types.h"
#include "common.h"
#include "fat.h"
@@ -83,11 +86,12 @@ int recover_HPFS(disk_t *disk_car, const struct fat_boot_sector *hpfs_header, pa
int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
{
- unsigned char buffer[disk_car->sector_size];
- if((unsigned)disk_car->pread(disk_car, &buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
+ unsigned char *buffer=(unsigned char *)MALLOC(disk_car->sector_size);
+ if((unsigned)disk_car->pread(disk_car, buffer, disk_car->sector_size, partition->part_offset) != disk_car->sector_size)
{
screen_buffer_add("check_HPFS: Read error\n");
log_error("check_HPFS: Read error\n");
+ free(buffer);
return 1;
}
if(test_HPFS(disk_car,(const struct fat_boot_sector *)buffer,partition,verbose,0)!=0)
@@ -97,10 +101,10 @@ int check_HPFS(disk_t *disk_car,partition_t *partition,const int verbose)
log_info("\n\ntest_HPFS()\n");
log_partition(disk_car,partition);
}
+ free(buffer);
return 1;
}
set_HPFS_info(partition);
+ free(buffer);
return 0;
}
-
-