From 7b4e4534f9361b21d3fafdd88a58f133decee38c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 26 Oct 1997 03:41:24 +0000 Subject: Many files: Added definition of ext2fs_get_mem, ext2fs_free_mem, and ext2fs_resize_mem in ext2fs.h, and changed all library routines to use these wrapper functions. --- lib/ext2fs/dirblock.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/ext2fs/dirblock.c') diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c index 6958bee7..0bb7cc55 100644 --- a/lib/ext2fs/dirblock.c +++ b/lib/ext2fs/dirblock.c @@ -56,9 +56,10 @@ errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block, if ((fs->flags & EXT2_FLAG_SWAP_BYTES) || (fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) { - write_buf = buf = malloc(fs->blocksize); - if (!buf) - return EXT2_NO_MEMORY; + retval = ext2fs_get_mem(fs->blocksize, (void **) &buf); + if (retval) + return retval; + write_buf = buf; memcpy(buf, inbuf, fs->blocksize); p = buf; end = buf + fs->blocksize; @@ -73,7 +74,7 @@ errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block, write_buf = inbuf; retval = io_channel_write_blk(fs->io, block, 1, write_buf); if (buf) - free(buf); + ext2fs_free_mem((void **) &buf); return retval; } -- cgit v1.2.3