]> git.saurik.com Git - apple/hfs.git/blobdiff - tests/cases/test-fsinfo.c
hfs-407.200.4.tar.gz
[apple/hfs.git] / tests / cases / test-fsinfo.c
index 7d1c7dba355bd665fab0b4f44cee0c18b34cb50c..56d413d44c3587d6da29a9094ffae18c871e5d22 100644 (file)
@@ -249,7 +249,7 @@ static void setup_testvolume()
 {
        char            *path;
        int                             fd;
-       void            *buf = malloc(1 KB);
+       void            *buf;
        
        // Create a test folder with MAX_FILES files
        assert_no_err(systemx("/bin/rm", "-rf", srcdir, NULL));
@@ -261,10 +261,12 @@ static void setup_testvolume()
                assert_with_errno((fd = open(path, O_RDWR | O_TRUNC | O_CREAT, 0666)) >= 0);
                free(path);
                
-               unsigned buf_size = (1 KB) * i;
+               unsigned buf_size = (1 KB) * (i + 1);
                buf = malloc(buf_size);
                memset(buf, 0x25, buf_size);
                check_io(write(fd, buf, buf_size), buf_size);
+               free(buf);
+               close(fd);
        }
 }