if (fs->io != fs->journal_io)
io_channel_close(fs->journal_io);
fs->journal_io = NULL;
+ free(fs->journal_name);
+ fs->journal_name = NULL;
}
#ifndef USE_INODE_IO
ext2fs_u32_list_free(ctx->encrypted_dirs);
ctx->encrypted_dirs = 0;
}
+ if (ctx->inode_count) {
+ ext2fs_free_icount(ctx->inode_count);
+ ctx->inode_count = 0;
+ }
/* Clear statistic counters */
ctx->fs_directory_count = 0;
if (cd.pctx.errcode) {
fix_problem(ctx, PR_2_ALLOCATE_ICOUNT, &cd.pctx);
ctx->flags |= E2F_FLAG_ABORT;
- return;
+ goto cleanup;
}
buf = (char *) e2fsck_allocate_memory(ctx, 2*fs->blocksize,
"directory scan buffer");
}
if (ctx->flags & E2F_FLAG_RUN_RETURN)
- return;
+ goto cleanup;
if (cd.pctx.errcode) {
fix_problem(ctx, PR_2_DBLIST_ITERATE, &cd.pctx);
ctx->flags |= E2F_FLAG_ABORT;
- return;
+ goto cleanup;
}
for (i=0; (dx_dir = e2fsck_dx_dir_info_iter(ctx, &i)) != 0;) {
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
- return;
+ goto cleanup;
if (e2fsck_dir_will_be_rehashed(ctx, dx_dir->ino) ||
dx_dir->numblocks == 0)
continue;
}
print_resource_track(ctx, _("Pass 2"), &rtrack, fs->io);
+cleanup:
+ ext2fs_free_mem(&buf);
}
#define MAX_DEPTH 32000
if (qctx->quota_file[qtype]) {
h = qctx->quota_file[qtype];
if (((flags & EXT2_FILE_WRITE) == 0) ||
- (h->qh_file_flags & EXT2_FILE_WRITE))
+ (h->qh_file_flags & EXT2_FILE_WRITE)) {
+ ext2fs_file_close(e2_file);
return 0;
+ }
(void) quota_file_close(qctx, h);
}
err = ext2fs_get_mem(sizeof(struct quota_handle), &h);
if (err) {
log_err("Unable to allocate quota handle");
+ ext2fs_file_close(e2_file);
return err;
}
allocated_handle = 1;
retval = io_channel_write_blk64(fs->io,
fs->super->s_first_data_block+1,
1, buf);
+ (void) ext2fs_free_mem(&buf);
if (retval) {
com_err("create_journal_dev", retval, "%s",
_("while writing journal superblock"));
static errcode_t init_list(struct str_list *sl)
{
sl->num = 0;
- sl->max = 0;
+ sl->max = 1;
sl->list = malloc((sl->max+1) * sizeof(char *));
if (!sl->list)
return ENOMEM;
ext2fs_blocks_count_set(&fs_param, fs_blocks_count);
if (ext2fs_has_feature_journal_dev(&fs_param)) {
+ int i;
+
+ for (i=0; fs_types[i]; i++) {
+ free(fs_types[i]);
+ fs_types[i] = 0;
+ }
fs_types[0] = strdup("journal");
fs_types[1] = 0;
}