summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-10-08 18:34:26 +0200
committerJustus Winter <justus@gnupg.org>2016-11-10 15:31:02 +0100
commit60b22ef4e7472a014e17c354c874eebddea12031 (patch)
treedb2a9005fa35c3ccf117b0aa853cbb2ee020a9f0
parent55d048463e7997197db2caf3c537207f3b0de203 (diff)
ext2fs: Fix potential block leak.
* ext2fs/xattr.c (ext2_set_xattr): We allocate a block, but only register it as the inodes acl block on success. Make sure to deallocate the block otherwise.
-rw-r--r--ext2fs/xattr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext2fs/xattr.c b/ext2fs/xattr.c
index c5771fe0..13668845 100644
--- a/ext2fs/xattr.c
+++ b/ext2fs/xattr.c
@@ -867,6 +867,10 @@ ext2_set_xattr (struct node *np, const char *name, const char *value,
cleanup:
if (block)
disk_cache_block_deref (block);
+ if (ei->i_file_acl == 0 && blkno != 0)
+ /* We allocated a block, but for some reason we did not register
+ it. */
+ ext2_free_blocks (blkno, 1);
dino_deref (ei);
return err;