summaryrefslogtreecommitdiff
path: root/usr/src/boot/lib/libstand/cd9660.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/boot/lib/libstand/cd9660.c')
-rw-r--r--usr/src/boot/lib/libstand/cd9660.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/src/boot/lib/libstand/cd9660.c b/usr/src/boot/lib/libstand/cd9660.c
index 487b994408..a17146fce5 100644
--- a/usr/src/boot/lib/libstand/cd9660.c
+++ b/usr/src/boot/lib/libstand/cd9660.c
@@ -286,7 +286,7 @@ cd9660_open(const char *path, struct open_file *f)
struct file *fp = NULL;
void *buf;
struct iso_primary_descriptor *vd;
- size_t buf_size, read, dsize, off;
+ size_t read, dsize, off;
daddr_t bno, boff;
struct iso_directory_record rec;
struct iso_directory_record *dp = NULL;
@@ -294,7 +294,8 @@ cd9660_open(const char *path, struct open_file *f)
bool isdir = false;
/* First find the volume descriptor */
- buf = malloc(buf_size = ISO_DEFAULT_BLOCK_SIZE);
+ buf = malloc(MAX(ISO_DEFAULT_BLOCK_SIZE,
+ sizeof (struct iso_primary_descriptor)));
vd = buf;
for (bno = 16; ; bno++) {
twiddle(1);
@@ -438,8 +439,7 @@ cd9660_open(const char *path, struct open_file *f)
return (0);
out:
- if (fp)
- free(fp);
+ free(fp);
free(buf);
return (rc);