Whamcloud - gitweb
po: update sv.po (from translationproject.org)
[tools/e2fsprogs.git] / lib / ext2fs / inode_io.c
index 0e23494..8e0944e 100644 (file)
@@ -5,11 +5,12 @@
  * Copyright (C) 2002 Theodore Ts'o.
  *
  * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
  * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -56,11 +57,11 @@ static errcode_t inode_write_blk(io_channel channel, unsigned long block,
 static errcode_t inode_flush(io_channel channel);
 static errcode_t inode_write_byte(io_channel channel, unsigned long offset,
                                int size, const void *data);
-static errcode_t inode_read_blk64(io_channel channel, 
+static errcode_t inode_read_blk64(io_channel channel,
                                unsigned long long block, int count, void *data);
-static errcode_t inode_write_blk64(io_channel channel, 
+static errcode_t inode_write_blk64(io_channel channel,
                                unsigned long long block, int count, const void *data);
-                               
+
 static struct struct_io_manager struct_inode_manager = {
        EXT2_ET_MAGIC_IO_MANAGER,
        "Inode I/O Manager",
@@ -158,14 +159,15 @@ static errcode_t inode_open(const char *name, int flags, io_channel *channel)
                                   &data->file);
        if (retval)
                goto cleanup;
-               
+
        *channel = io;
        return 0;
 
 cleanup:
-       if (data) {
+       if (io && io->name)
+               ext2fs_free_mem(&io->name);
+       if (data)
                ext2fs_free_mem(&data);
-       }
        if (io)
                ext2fs_free_mem(&io);
        return retval;
@@ -184,7 +186,7 @@ static errcode_t inode_close(io_channel channel)
                return 0;
 
        retval = ext2fs_file_close(data->file);
-       
+
        ext2fs_free_mem(&channel->private_data);
        if (channel->name)
                ext2fs_free_mem(&channel->name);
@@ -251,7 +253,7 @@ static errcode_t inode_write_blk64(io_channel channel,
        return ext2fs_file_write(data->file, buf, count, 0);
 }
 
-static errcode_t inode_write_blk(io_channel channel, unsigned long block, 
+static errcode_t inode_write_blk(io_channel channel, unsigned long block,
                                int count, const void *buf)
 {
        return inode_write_blk64(channel, block, count, buf);
@@ -275,12 +277,12 @@ static errcode_t inode_write_byte(io_channel channel, unsigned long offset,
 }
 
 /*
- * Flush data buffers to disk.  
+ * Flush data buffers to disk.
  */
 static errcode_t inode_flush(io_channel channel)
 {
        struct inode_private_data *data;
-       
+
        EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
        data = (struct inode_private_data *) channel->private_data;
        EXT2_CHECK_MAGIC(data, EXT2_ET_MAGIC_INODE_IO_CHANNEL);