Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
libext2fs: fix potential resource leak in ext2fs_file_write
[tools/e2fsprogs.git]
/
lib
/
ext2fs
/
fileio.c
diff --git
a/lib/ext2fs/fileio.c
b/lib/ext2fs/fileio.c
index
a5d90a7
..
a0b5d97
100644
(file)
--- a/
lib/ext2fs/fileio.c
+++ b/
lib/ext2fs/fileio.c
@@
-467,8
+467,11
@@
errcode_t ext2fs_file_write(ext2_file_t file, const void *buf,
bmap_flags,
file->blockno, 0,
&file->physblock);
- if (retval)
+ if (retval) {
+ free(new_block);
+ new_block = NULL;
goto fail;
+ }
if (new_block) {
new_block->physblock = file->physblock;