diff options
Diffstat (limited to 'e2fsprogs/ext2fs')
-rw-r--r-- | e2fsprogs/ext2fs/bmap.c | 3 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/bmove.c | 6 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/brel_ma.c | 6 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/dblist.c | 3 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/fileio.c | 6 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/freefs.c | 52 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/get_pathname.c | 3 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/icount.c | 9 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/imager.c | 3 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/inode.c | 2 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/irel_ma.c | 18 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/mkdir.c | 3 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/namei.c | 3 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/rw_bitmaps.c | 11 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/test_io.c | 9 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/unix_io.c | 9 |
16 files changed, 47 insertions, 99 deletions
diff --git a/e2fsprogs/ext2fs/bmap.c b/e2fsprogs/ext2fs/bmap.c index 45d49f929..4a53ebc4c 100644 --- a/e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/ext2fs/bmap.c | |||
@@ -257,8 +257,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, | |||
257 | retval = block_tind_bmap(fs, bmap_flags, b, block_buf, | 257 | retval = block_tind_bmap(fs, bmap_flags, b, block_buf, |
258 | &blocks_alloc, block, phys_blk); | 258 | &blocks_alloc, block, phys_blk); |
259 | done: | 259 | done: |
260 | if (buf) | 260 | ext2fs_free_mem(&buf); |
261 | ext2fs_free_mem(&buf); | ||
262 | if ((retval == 0) && (blocks_alloc || inode_dirty)) { | 261 | if ((retval == 0) && (blocks_alloc || inode_dirty)) { |
263 | inode->i_blocks += (blocks_alloc * fs->blocksize) / 512; | 262 | inode->i_blocks += (blocks_alloc * fs->blocksize) / 512; |
264 | retval = ext2fs_write_inode(fs, ino, inode); | 263 | retval = ext2fs_write_inode(fs, ino, inode); |
diff --git a/e2fsprogs/ext2fs/bmove.c b/e2fsprogs/ext2fs/bmove.c index fb319f8c3..7e98c0fe5 100644 --- a/e2fsprogs/ext2fs/bmove.c +++ b/e2fsprogs/ext2fs/bmove.c | |||
@@ -119,10 +119,8 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs, | |||
119 | * block move. | 119 | * block move. |
120 | */ | 120 | */ |
121 | if (flags & EXT2_BMOVE_GET_DBLIST) { | 121 | if (flags & EXT2_BMOVE_GET_DBLIST) { |
122 | if (fs->dblist) { | 122 | ext2fs_free_dblist(fs->dblist); |
123 | ext2fs_free_dblist(fs->dblist); | 123 | fs->dblist = NULL; |
124 | fs->dblist = NULL; | ||
125 | } | ||
126 | retval = ext2fs_init_dblist(fs, 0); | 124 | retval = ext2fs_init_dblist(fs, 0); |
127 | if (retval) | 125 | if (retval) |
128 | return retval; | 126 | return retval; |
diff --git a/e2fsprogs/ext2fs/brel_ma.c b/e2fsprogs/ext2fs/brel_ma.c index 4dcfded37..557143d51 100644 --- a/e2fsprogs/ext2fs/brel_ma.c +++ b/e2fsprogs/ext2fs/brel_ma.c | |||
@@ -186,12 +186,10 @@ static errcode_t bma_free(ext2_brel brel) | |||
186 | ma = brel->priv_data; | 186 | ma = brel->priv_data; |
187 | 187 | ||
188 | if (ma) { | 188 | if (ma) { |
189 | if (ma->entries) | 189 | ext2fs_free_mem(&ma->entries); |
190 | ext2fs_free_mem(&ma->entries); | ||
191 | ext2fs_free_mem(&ma); | 190 | ext2fs_free_mem(&ma); |
192 | } | 191 | } |
193 | if (brel->name) | 192 | ext2fs_free_mem(&brel->name); |
194 | ext2fs_free_mem(&brel->name); | ||
195 | ext2fs_free_mem(&brel); | 193 | ext2fs_free_mem(&brel); |
196 | return 0; | 194 | return 0; |
197 | } | 195 | } |
diff --git a/e2fsprogs/ext2fs/dblist.c b/e2fsprogs/ext2fs/dblist.c index 0cf5698fa..73313faf3 100644 --- a/e2fsprogs/ext2fs/dblist.c +++ b/e2fsprogs/ext2fs/dblist.c | |||
@@ -99,8 +99,7 @@ static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count, | |||
99 | fs->dblist = dblist; | 99 | fs->dblist = dblist; |
100 | return 0; | 100 | return 0; |
101 | cleanup: | 101 | cleanup: |
102 | if (dblist) | 102 | ext2fs_free_mem(&dblist); |
103 | ext2fs_free_mem(&dblist); | ||
104 | return retval; | 103 | return retval; |
105 | } | 104 | } |
106 | 105 | ||
diff --git a/e2fsprogs/ext2fs/fileio.c b/e2fsprogs/ext2fs/fileio.c index 669e80c65..da349fea2 100644 --- a/e2fsprogs/ext2fs/fileio.c +++ b/e2fsprogs/ext2fs/fileio.c | |||
@@ -73,8 +73,7 @@ errcode_t ext2fs_file_open2(ext2_filsys fs, ext2_ino_t ino, | |||
73 | return 0; | 73 | return 0; |
74 | 74 | ||
75 | fail: | 75 | fail: |
76 | if (file->buf) | 76 | ext2fs_free_mem(&file->buf); |
77 | ext2fs_free_mem(&file->buf); | ||
78 | ext2fs_free_mem(&file); | 77 | ext2fs_free_mem(&file); |
79 | return retval; | 78 | return retval; |
80 | } | 79 | } |
@@ -197,8 +196,7 @@ errcode_t ext2fs_file_close(ext2_file_t file) | |||
197 | 196 | ||
198 | retval = ext2fs_file_flush(file); | 197 | retval = ext2fs_file_flush(file); |
199 | 198 | ||
200 | if (file->buf) | 199 | ext2fs_free_mem(&file->buf); |
201 | ext2fs_free_mem(&file->buf); | ||
202 | ext2fs_free_mem(&file); | 200 | ext2fs_free_mem(&file); |
203 | 201 | ||
204 | return retval; | 202 | return retval; |
diff --git a/e2fsprogs/ext2fs/freefs.c b/e2fsprogs/ext2fs/freefs.c index 3fd51f257..f0f7b3eec 100644 --- a/e2fsprogs/ext2fs/freefs.c +++ b/e2fsprogs/ext2fs/freefs.c | |||
@@ -30,25 +30,17 @@ void ext2fs_free(ext2_filsys fs) | |||
30 | if (fs->io) { | 30 | if (fs->io) { |
31 | io_channel_close(fs->io); | 31 | io_channel_close(fs->io); |
32 | } | 32 | } |
33 | if (fs->device_name) | 33 | ext2fs_free_mem(&fs->device_name); |
34 | ext2fs_free_mem(&fs->device_name); | 34 | ext2fs_free_mem(&fs->super); |
35 | if (fs->super) | 35 | ext2fs_free_mem(&fs->orig_super); |
36 | ext2fs_free_mem(&fs->super); | 36 | ext2fs_free_mem(&fs->group_desc); |
37 | if (fs->orig_super) | 37 | ext2fs_free_block_bitmap(fs->block_map); |
38 | ext2fs_free_mem(&fs->orig_super); | 38 | ext2fs_free_inode_bitmap(fs->inode_map); |
39 | if (fs->group_desc) | 39 | |
40 | ext2fs_free_mem(&fs->group_desc); | 40 | ext2fs_badblocks_list_free(fs->badblocks); |
41 | if (fs->block_map) | ||
42 | ext2fs_free_block_bitmap(fs->block_map); | ||
43 | if (fs->inode_map) | ||
44 | ext2fs_free_inode_bitmap(fs->inode_map); | ||
45 | |||
46 | if (fs->badblocks) | ||
47 | ext2fs_badblocks_list_free(fs->badblocks); | ||
48 | fs->badblocks = 0; | 41 | fs->badblocks = 0; |
49 | 42 | ||
50 | if (fs->dblist) | 43 | ext2fs_free_dblist(fs->dblist); |
51 | ext2fs_free_dblist(fs->dblist); | ||
52 | 44 | ||
53 | if (fs->icache) | 45 | if (fs->icache) |
54 | ext2fs_free_inode_cache(fs->icache); | 46 | ext2fs_free_inode_cache(fs->icache); |
@@ -64,14 +56,8 @@ void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap) | |||
64 | return; | 56 | return; |
65 | 57 | ||
66 | bitmap->magic = 0; | 58 | bitmap->magic = 0; |
67 | if (bitmap->description) { | 59 | ext2fs_free_mem(&bitmap->description); |
68 | ext2fs_free_mem(&bitmap->description); | 60 | ext2fs_free_mem(&bitmap->bitmap); |
69 | bitmap->description = 0; | ||
70 | } | ||
71 | if (bitmap->bitmap) { | ||
72 | ext2fs_free_mem(&bitmap->bitmap); | ||
73 | bitmap->bitmap = 0; | ||
74 | } | ||
75 | ext2fs_free_mem(&bitmap); | 61 | ext2fs_free_mem(&bitmap); |
76 | } | 62 | } |
77 | 63 | ||
@@ -100,10 +86,8 @@ static void ext2fs_free_inode_cache(struct ext2_inode_cache *icache) | |||
100 | { | 86 | { |
101 | if (--icache->refcount) | 87 | if (--icache->refcount) |
102 | return; | 88 | return; |
103 | if (icache->buffer) | 89 | ext2fs_free_mem(&icache->buffer); |
104 | ext2fs_free_mem(&icache->buffer); | 90 | ext2fs_free_mem(&icache->cache); |
105 | if (icache->cache) | ||
106 | ext2fs_free_mem(&icache->cache); | ||
107 | icache->buffer_blk = 0; | 91 | icache->buffer_blk = 0; |
108 | ext2fs_free_mem(&icache); | 92 | ext2fs_free_mem(&icache); |
109 | } | 93 | } |
@@ -113,12 +97,10 @@ static void ext2fs_free_inode_cache(struct ext2_inode_cache *icache) | |||
113 | */ | 97 | */ |
114 | void ext2fs_u32_list_free(ext2_u32_list bb) | 98 | void ext2fs_u32_list_free(ext2_u32_list bb) |
115 | { | 99 | { |
116 | if (bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) | 100 | if (!bb || bb->magic != EXT2_ET_MAGIC_BADBLOCKS_LIST) |
117 | return; | 101 | return; |
118 | 102 | ||
119 | if (bb->list) | 103 | ext2fs_free_mem(&bb->list); |
120 | ext2fs_free_mem(&bb->list); | ||
121 | bb->list = 0; | ||
122 | ext2fs_free_mem(&bb); | 104 | ext2fs_free_mem(&bb); |
123 | } | 105 | } |
124 | 106 | ||
@@ -136,9 +118,7 @@ void ext2fs_free_dblist(ext2_dblist dblist) | |||
136 | if (!dblist || (dblist->magic != EXT2_ET_MAGIC_DBLIST)) | 118 | if (!dblist || (dblist->magic != EXT2_ET_MAGIC_DBLIST)) |
137 | return; | 119 | return; |
138 | 120 | ||
139 | if (dblist->list) | 121 | ext2fs_free_mem(&dblist->list); |
140 | ext2fs_free_mem(&dblist->list); | ||
141 | dblist->list = 0; | ||
142 | if (dblist->fs && dblist->fs->dblist == dblist) | 122 | if (dblist->fs && dblist->fs->dblist == dblist) |
143 | dblist->fs->dblist = 0; | 123 | dblist->fs->dblist = 0; |
144 | dblist->magic = 0; | 124 | dblist->magic = 0; |
diff --git a/e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/ext2fs/get_pathname.c index 594090da0..000479096 100644 --- a/e2fsprogs/ext2fs/get_pathname.c +++ b/e2fsprogs/ext2fs/get_pathname.c | |||
@@ -132,8 +132,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, | |||
132 | retval = 0; | 132 | retval = 0; |
133 | 133 | ||
134 | cleanup: | 134 | cleanup: |
135 | if (gp.name) | 135 | ext2fs_free_mem(&gp.name); |
136 | ext2fs_free_mem(&gp.name); | ||
137 | return retval; | 136 | return retval; |
138 | } | 137 | } |
139 | 138 | ||
diff --git a/e2fsprogs/ext2fs/icount.c b/e2fsprogs/ext2fs/icount.c index 01677775f..7ae2a5c0f 100644 --- a/e2fsprogs/ext2fs/icount.c +++ b/e2fsprogs/ext2fs/icount.c | |||
@@ -59,12 +59,9 @@ void ext2fs_free_icount(ext2_icount_t icount) | |||
59 | return; | 59 | return; |
60 | 60 | ||
61 | icount->magic = 0; | 61 | icount->magic = 0; |
62 | if (icount->list) | 62 | ext2fs_free_mem(&icount->list); |
63 | ext2fs_free_mem(&icount->list); | 63 | ext2fs_free_inode_bitmap(icount->single); |
64 | if (icount->single) | 64 | ext2fs_free_inode_bitmap(icount->multiple); |
65 | ext2fs_free_inode_bitmap(icount->single); | ||
66 | if (icount->multiple) | ||
67 | ext2fs_free_inode_bitmap(icount->multiple); | ||
68 | ext2fs_free_mem(&icount); | 65 | ext2fs_free_mem(&icount); |
69 | } | 66 | } |
70 | 67 | ||
diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 00eb71723..ece66fc30 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c | |||
@@ -371,7 +371,6 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) | |||
371 | 371 | ||
372 | retval = 0; | 372 | retval = 0; |
373 | errout: | 373 | errout: |
374 | if (buf) | 374 | free(buf); |
375 | free(buf); | ||
376 | return (retval); | 375 | return (retval); |
377 | } | 376 | } |
diff --git a/e2fsprogs/ext2fs/inode.c b/e2fsprogs/ext2fs/inode.c index e50bece40..4c386c77c 100644 --- a/e2fsprogs/ext2fs/inode.c +++ b/e2fsprogs/ext2fs/inode.c | |||
@@ -123,7 +123,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks, | |||
123 | save_get_blocks = fs->get_blocks; | 123 | save_get_blocks = fs->get_blocks; |
124 | fs->get_blocks = 0; | 124 | fs->get_blocks = 0; |
125 | retval = ext2fs_read_bb_inode(fs, &fs->badblocks); | 125 | retval = ext2fs_read_bb_inode(fs, &fs->badblocks); |
126 | if (retval && fs->badblocks) { | 126 | if (retval) { |
127 | ext2fs_badblocks_list_free(fs->badblocks); | 127 | ext2fs_badblocks_list_free(fs->badblocks); |
128 | fs->badblocks = 0; | 128 | fs->badblocks = 0; |
129 | } | 129 | } |
diff --git a/e2fsprogs/ext2fs/irel_ma.c b/e2fsprogs/ext2fs/irel_ma.c index d9e73f73c..f4fe1e0f3 100644 --- a/e2fsprogs/ext2fs/irel_ma.c +++ b/e2fsprogs/ext2fs/irel_ma.c | |||
@@ -309,8 +309,7 @@ static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new) | |||
309 | return ENOENT; | 309 | return ENOENT; |
310 | 310 | ||
311 | ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; | 311 | ma->entries[(unsigned) new] = ma->entries[(unsigned) old]; |
312 | if (ma->ref_entries[(unsigned) new].refs) | 312 | ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); |
313 | ext2fs_free_mem(&ma->ref_entries[(unsigned) new].refs); | ||
314 | ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; | 313 | ma->ref_entries[(unsigned) new] = ma->ref_entries[(unsigned) old]; |
315 | 314 | ||
316 | ma->entries[(unsigned) old].new = 0; | 315 | ma->entries[(unsigned) old].new = 0; |
@@ -332,8 +331,7 @@ static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old) | |||
332 | return ENOENT; | 331 | return ENOENT; |
333 | 332 | ||
334 | ma->entries[old].new = 0; | 333 | ma->entries[old].new = 0; |
335 | if (ma->ref_entries[(unsigned) old].refs) | 334 | ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); |
336 | ext2fs_free_mem(&ma->ref_entries[(unsigned) old].refs); | ||
337 | ma->orig_map[ma->entries[(unsigned) old].orig] = 0; | 335 | ma->orig_map[ma->entries[(unsigned) old].orig] = 0; |
338 | 336 | ||
339 | ma->ref_entries[(unsigned) old].num = 0; | 337 | ma->ref_entries[(unsigned) old].num = 0; |
@@ -352,21 +350,17 @@ static errcode_t ima_free(ext2_irel irel) | |||
352 | ma = irel->priv_data; | 350 | ma = irel->priv_data; |
353 | 351 | ||
354 | if (ma) { | 352 | if (ma) { |
355 | if (ma->orig_map) | 353 | ext2fs_free_mem(&ma->orig_map); |
356 | ext2fs_free_mem(&ma->orig_map); | 354 | ext2fs_free_mem(&ma->entries); |
357 | if (ma->entries) | ||
358 | ext2fs_free_mem(&ma->entries); | ||
359 | if (ma->ref_entries) { | 355 | if (ma->ref_entries) { |
360 | for (ino = 0; ino <= ma->max_inode; ino++) { | 356 | for (ino = 0; ino <= ma->max_inode; ino++) { |
361 | if (ma->ref_entries[(unsigned) ino].refs) | 357 | ext2fs_free_mem(&ma->ref_entries[(unsigned) ino].refs); |
362 | ext2fs_free_mem(&ma->ref_entries[(unsigned) ino].refs); | ||
363 | } | 358 | } |
364 | ext2fs_free_mem(&ma->ref_entries); | 359 | ext2fs_free_mem(&ma->ref_entries); |
365 | } | 360 | } |
366 | ext2fs_free_mem(&ma); | 361 | ext2fs_free_mem(&ma); |
367 | } | 362 | } |
368 | if (irel->name) | 363 | ext2fs_free_mem(&irel->name); |
369 | ext2fs_free_mem(&irel->name); | ||
370 | ext2fs_free_mem(&irel); | 364 | ext2fs_free_mem(&irel); |
371 | return 0; | 365 | return 0; |
372 | } | 366 | } |
diff --git a/e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/ext2fs/mkdir.c index bf46e5050..c3c03711c 100644 --- a/e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/ext2fs/mkdir.c | |||
@@ -133,8 +133,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum, | |||
133 | ext2fs_inode_alloc_stats2(fs, ino, +1, 1); | 133 | ext2fs_inode_alloc_stats2(fs, ino, +1, 1); |
134 | 134 | ||
135 | cleanup: | 135 | cleanup: |
136 | if (block) | 136 | ext2fs_free_mem(&block); |
137 | ext2fs_free_mem(&block); | ||
138 | return retval; | 137 | return retval; |
139 | 138 | ||
140 | } | 139 | } |
diff --git a/e2fsprogs/ext2fs/namei.c b/e2fsprogs/ext2fs/namei.c index 6ce4bb363..2c372f4e2 100644 --- a/e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/ext2fs/namei.c | |||
@@ -61,8 +61,7 @@ static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir, | |||
61 | pathname = (char *)&(ei.i_block[0]); | 61 | pathname = (char *)&(ei.i_block[0]); |
62 | retval = open_namei(fs, root, dir, pathname, ei.i_size, 1, | 62 | retval = open_namei(fs, root, dir, pathname, ei.i_size, 1, |
63 | link_count, buf, res_inode); | 63 | link_count, buf, res_inode); |
64 | if (buffer) | 64 | ext2fs_free_mem(&buffer); |
65 | ext2fs_free_mem(&buffer); | ||
66 | return retval; | 65 | return retval; |
67 | } | 66 | } |
68 | 67 | ||
diff --git a/e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/ext2fs/rw_bitmaps.c index ae7b6e0cf..d5698a221 100644 --- a/e2fsprogs/ext2fs/rw_bitmaps.c +++ b/e2fsprogs/ext2fs/rw_bitmaps.c | |||
@@ -163,8 +163,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
163 | if (retval) | 163 | if (retval) |
164 | return retval; | 164 | return retval; |
165 | if (do_block) { | 165 | if (do_block) { |
166 | if (fs->block_map) | 166 | ext2fs_free_block_bitmap(fs->block_map); |
167 | ext2fs_free_block_bitmap(fs->block_map); | ||
168 | sprintf(buf, "block bitmap for %s", fs->device_name); | 167 | sprintf(buf, "block bitmap for %s", fs->device_name); |
169 | retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); | 168 | retval = ext2fs_allocate_block_bitmap(fs, buf, &fs->block_map); |
170 | if (retval) | 169 | if (retval) |
@@ -172,8 +171,7 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
172 | block_bitmap = fs->block_map->bitmap; | 171 | block_bitmap = fs->block_map->bitmap; |
173 | } | 172 | } |
174 | if (do_inode) { | 173 | if (do_inode) { |
175 | if (fs->inode_map) | 174 | ext2fs_free_inode_bitmap(fs->inode_map); |
176 | ext2fs_free_inode_bitmap(fs->inode_map); | ||
177 | sprintf(buf, "inode bitmap for %s", fs->device_name); | 175 | sprintf(buf, "inode bitmap for %s", fs->device_name); |
178 | retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); | 176 | retval = ext2fs_allocate_inode_bitmap(fs, buf, &fs->inode_map); |
179 | if (retval) | 177 | if (retval) |
@@ -247,14 +245,11 @@ static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block) | |||
247 | cleanup: | 245 | cleanup: |
248 | if (do_block) { | 246 | if (do_block) { |
249 | ext2fs_free_mem(&fs->block_map); | 247 | ext2fs_free_mem(&fs->block_map); |
250 | fs->block_map = 0; | ||
251 | } | 248 | } |
252 | if (do_inode) { | 249 | if (do_inode) { |
253 | ext2fs_free_mem(&fs->inode_map); | 250 | ext2fs_free_mem(&fs->inode_map); |
254 | fs->inode_map = 0; | ||
255 | } | 251 | } |
256 | if (buf) | 252 | ext2fs_free_mem(&buf); |
257 | ext2fs_free_mem(&buf); | ||
258 | return retval; | 253 | return retval; |
259 | } | 254 | } |
260 | 255 | ||
diff --git a/e2fsprogs/ext2fs/test_io.c b/e2fsprogs/ext2fs/test_io.c index d4b36532f..45f9090cb 100644 --- a/e2fsprogs/ext2fs/test_io.c +++ b/e2fsprogs/ext2fs/test_io.c | |||
@@ -203,10 +203,8 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel) | |||
203 | return 0; | 203 | return 0; |
204 | 204 | ||
205 | cleanup: | 205 | cleanup: |
206 | if (io) | 206 | ext2fs_free_mem(&io); |
207 | ext2fs_free_mem(&io); | 207 | ext2fs_free_mem(&data); |
208 | if (data) | ||
209 | ext2fs_free_mem(&data); | ||
210 | return retval; | 208 | return retval; |
211 | } | 209 | } |
212 | 210 | ||
@@ -229,8 +227,7 @@ static errcode_t test_close(io_channel channel) | |||
229 | fclose(data->outfile); | 227 | fclose(data->outfile); |
230 | 228 | ||
231 | ext2fs_free_mem(&channel->private_data); | 229 | ext2fs_free_mem(&channel->private_data); |
232 | if (channel->name) | 230 | ext2fs_free_mem(&channel->name); |
233 | ext2fs_free_mem(&channel->name); | ||
234 | ext2fs_free_mem(&channel); | 231 | ext2fs_free_mem(&channel); |
235 | return retval; | 232 | return retval; |
236 | } | 233 | } |
diff --git a/e2fsprogs/ext2fs/unix_io.c b/e2fsprogs/ext2fs/unix_io.c index 36b222577..7f57afddc 100644 --- a/e2fsprogs/ext2fs/unix_io.c +++ b/e2fsprogs/ext2fs/unix_io.c | |||
@@ -280,8 +280,7 @@ static void free_cache(struct unix_private_data *data) | |||
280 | cache->access_time = 0; | 280 | cache->access_time = 0; |
281 | cache->dirty = 0; | 281 | cache->dirty = 0; |
282 | cache->in_use = 0; | 282 | cache->in_use = 0; |
283 | if (cache->buf) | 283 | ext2fs_free_mem(&cache->buf); |
284 | ext2fs_free_mem(&cache->buf); | ||
285 | cache->buf = 0; | 284 | cache->buf = 0; |
286 | } | 285 | } |
287 | } | 286 | } |
@@ -461,8 +460,7 @@ cleanup: | |||
461 | free_cache(data); | 460 | free_cache(data); |
462 | ext2fs_free_mem(&data); | 461 | ext2fs_free_mem(&data); |
463 | } | 462 | } |
464 | if (io) | 463 | ext2fs_free_mem(&io); |
465 | ext2fs_free_mem(&io); | ||
466 | return retval; | 464 | return retval; |
467 | } | 465 | } |
468 | 466 | ||
@@ -487,8 +485,7 @@ static errcode_t unix_close(io_channel channel) | |||
487 | free_cache(data); | 485 | free_cache(data); |
488 | 486 | ||
489 | ext2fs_free_mem(&channel->private_data); | 487 | ext2fs_free_mem(&channel->private_data); |
490 | if (channel->name) | 488 | ext2fs_free_mem(&channel->name); |
491 | ext2fs_free_mem(&channel->name); | ||
492 | ext2fs_free_mem(&channel); | 489 | ext2fs_free_mem(&channel); |
493 | return retval; | 490 | return retval; |
494 | } | 491 | } |