X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=fs%2Fzfs%2Fzfs.c;h=fb2b3ee089ecadb8c82cb35bc7912ffce9cbf65d;hb=6e2f1538959d79b54a0ceeed2f24643cf98ebaa4;hp=099d51718b987039f5e1c93cfae5686b5e2f28e6;hpb=8b485ba12b0defa0c4ed3559789250238f8331a8;p=u-boot diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c index 099d51718b..fb2b3ee089 100644 --- a/fs/zfs/zfs.c +++ b/fs/zfs/zfs.c @@ -736,7 +736,7 @@ zap_hash(uint64_t salt, const char *name) uint64_t crc = salt; if (table[128] == 0) { - uint64_t *ct; + uint64_t *ct = NULL; int i, j; for (i = 0; i < 256; i++) { for (ct = table + i, *ct = i, j = 8; j > 0; j--) @@ -772,7 +772,7 @@ zap_leaf_array_equal(zap_leaf_phys_t *l, zfs_endian_t endian, while (bseen < array_len) { struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; - int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); + int toread = min(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) return 0; @@ -794,7 +794,7 @@ zap_leaf_array_get(zap_leaf_phys_t *l, zfs_endian_t endian, int blksft, while (bseen < array_len) { struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array; - int toread = MIN(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); + int toread = min(array_len - bseen, ZAP_LEAF_ARRAY_BYTES); if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft)) /* Don't use errno because this error is to be ignored. */ @@ -1060,6 +1060,7 @@ zap_lookup(dnode_end_t *zap_dnode, char *name, uint64_t *val, } printf("unknown ZAP type\n"); + free(zapbuf); return ZFS_ERR_BAD_FS; } @@ -1094,6 +1095,7 @@ zap_iterate(dnode_end_t *zap_dnode, return ret; } printf("unknown ZAP type\n"); + free(zapbuf); return 0; } @@ -1865,6 +1867,7 @@ zfs_mount(device_t dev) ubbest = malloc(sizeof(*ubbest)); if (!ubbest) { + free(ub_array); zfs_unmount(data); return 0; } @@ -1953,6 +1956,7 @@ zfs_mount(device_t dev) if (err) { printf("couldn't zio_read object directory\n"); zfs_unmount(data); + free(osp); free(ubbest); return 0; } @@ -2052,6 +2056,9 @@ zfs_open(struct zfs_file *file, const char *fsfilename) hdrsize = SA_HDR_SIZE(((sa_hdr_phys_t *) sahdrp)); file->size = *(uint64_t *) ((char *) sahdrp + hdrsize + SA_SIZE_OFFSET); + if ((data->dnode.dn.dn_bonuslen == 0) && + (data->dnode.dn.dn_flags & DNODE_FLAG_SPILL_BLKPTR)) + free(sahdrp); } else { file->size = zfs_to_cpu64(((znode_phys_t *) DN_BONUS(&data->dnode.dn))->zp_size, data->dnode.endian); } @@ -2118,7 +2125,7 @@ zfs_read(zfs_file_t file, char *buf, uint64_t len) data->file_start = blkid * blksz; data->file_end = data->file_start + blksz; - movesize = MIN(length, data->file_end - (int) file->offset - red); + movesize = min(length, data->file_end - (int)file->offset - red); memmove(buf, data->file_buf + file->offset + red - data->file_start, movesize);