]> code.delx.au - refind/blobdiff - filesystems/fsw_ntfs.c
Previous commit broke loading of EFI drivers with SB active; fix it.
[refind] / filesystems / fsw_ntfs.c
index a03bb2eb62d5d8c8c3323d787396068241c3206a..2fda530e639e2d6fac13725d776048316ab6e360 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * \file fsw_ntfs.c
  * ntfs file system driver code.
- * by Samuel Liao
+ * Copyright (C) 2015 by Samuel Liao
  */
 
 /*-
@@ -1339,7 +1339,7 @@ static fsw_status_t fsw_ntfs_dir_lookup(struct fsw_volume *volg, struct fsw_dnod
     buf = dno->idxroot + 16;
     len = dno->rootsz - 16;
     if(len < 0x18)
-       return FSW_NOT_FOUND;
+       goto notfound;
 
     while(depth < 10) {
        /* real index size */
@@ -1349,7 +1349,7 @@ static fsw_status_t fsw_ntfs_dir_lookup(struct fsw_volume *volg, struct fsw_dnod
        /* skip index header */
        off = GETU32(buf, 0);
        if(off >= len)
-           return FSW_NOT_FOUND;
+           goto notfound;
 
        block = 0;
        while(off + 0x18 <= len) {
@@ -1369,10 +1369,11 @@ static fsw_status_t fsw_ntfs_dir_lookup(struct fsw_volume *volg, struct fsw_dnod
            }
 
            if(cmp == 0) {
+               fsw_strfree(&s);
                return fsw_ntfs_create_subnode(dno, buf+off, child_dno);
            } else if(cmp < 0) {
                if(!(flag & 1) || !dno->has_idxtree)
-                   return FSW_NOT_FOUND;
+                   goto notfound;
                block = GETU64(buf, next-8) + 1;
                break;
            } else { /* cmp > 0 */
@@ -1389,6 +1390,8 @@ static fsw_status_t fsw_ntfs_dir_lookup(struct fsw_volume *volg, struct fsw_dnod
        depth++;
     }
 
+notfound:
+    fsw_strfree(&s);
     return FSW_NOT_FOUND;
 }