Changeset f456ab2 in mainline
- Timestamp:
- 2011-09-18T21:05:01Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 85ff862
- Parents:
- 40a2af3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
r40a2af3 rf456ab2 145 145 { 146 146 enum cache_mode cmode; 147 struct mfs_superblock *sb ;148 struct mfs3_superblock *sb3 ;149 struct mfs_sb_info *sbi ;150 struct mfs_instance *instance ;147 struct mfs_superblock *sb = NULL; 148 struct mfs3_superblock *sb3 = NULL; 149 struct mfs_sb_info *sbi = NULL; 150 struct mfs_instance *instance = NULL; 151 151 bool native, longnames; 152 152 mfs_version_t version; … … 168 168 sbi = malloc(sizeof(*sbi)); 169 169 if (!sbi) { 170 block_fini(service_id);171 return ENOMEM;170 rc = ENOMEM; 171 goto out_error; 172 172 } 173 173 … … 175 175 instance = malloc(sizeof(*instance)); 176 176 if (!instance) { 177 free(sbi); 178 block_fini(service_id); 179 return ENOMEM; 177 rc = ENOMEM; 178 goto out_error; 180 179 } 181 180 … … 184 183 sb = malloc(MFS_SUPERBLOCK_SIZE); 185 184 if (!sb) { 186 free(instance); 187 free(sbi); 188 block_fini(service_id); 189 return ENOMEM; 185 rc = ENOMEM; 186 goto out_error; 190 187 } 191 188 192 189 /* Read the superblock */ 193 190 rc = block_read_direct(service_id, MFS_SUPERBLOCK << 1, 2, sb); 194 if (rc != EOK) { 195 free(instance); 196 free(sbi); 197 free(sb); 198 block_fini(service_id); 199 return rc; 200 } 191 if (rc != EOK) 192 goto out_error; 201 193 202 194 sb3 = (struct mfs3_superblock *) sb; … … 211 203 /*Not recognized*/ 212 204 mfsdebug("magic number not recognized\n"); 213 free(instance); 214 free(sbi); 215 free(sb); 216 block_fini(service_id); 217 return ENOTSUP; 205 rc = ENOTSUP; 206 goto out_error; 218 207 } 219 208 … … 262 251 sbi->itable_off = 2 + sbi->ibmap_blocks + sbi->zbmap_blocks; 263 252 264 free(sb);265 266 253 rc = block_cache_init(service_id, sbi->block_size, 0, cmode); 267 254 if (rc != EOK) { 268 free(instance); 269 free(sbi); 270 free(sb); 255 mfsdebug("block cache initialization failed\n"); 271 256 block_cache_fini(service_id); 272 block_fini(service_id); 273 mfsdebug("block cache initialization failed\n"); 274 return EINVAL; 257 rc = EINVAL; 258 goto out_error; 275 259 } 276 260 … … 295 279 *linkcnt = 1; 296 280 281 free(sb); 282 297 283 return mfs_node_put(fn); 284 285 out_error: 286 block_fini(service_id); 287 if (sb) 288 free(sb); 289 if (sbi) 290 free(sbi); 291 if(instance) 292 free(instance); 293 return rc; 298 294 } 299 295
Note:
See TracChangeset
for help on using the changeset viewer.