Whamcloud - gitweb
Many files:
[tools/e2fsprogs.git] / lib / ext2fs / freefs.c
1 /*
2  * freefs.c --- free an ext2 filesystem
3  * 
4  * Copyright (C) 1993, 1994 Theodore Ts'o.  This file may be redistributed
5  * under the terms of the GNU Public License.
6  */
7
8 #include <stdio.h>
9 #include <unistd.h>
10 #include <stdlib.h>
11
12 #include <linux/fs.h>
13 #include <linux/ext2_fs.h>
14
15 #include "ext2fs.h"
16
17 void ext2fs_free(ext2_filsys fs)
18 {
19         if (!fs)
20                 return;
21         if (fs->io) {
22                 io_channel_close(fs->io);
23         }
24         if (fs->device_name)
25                 free(fs->device_name);
26         if (fs->super)
27                 free(fs->super);
28         if (fs->group_desc)
29                 free(fs->group_desc);
30         if (fs->block_map)
31                 free(fs->block_map);
32         if (fs->inode_map)
33                 free(fs->inode_map);
34         free(fs);
35 }
36