diff options
author | Petr Písař <ppisar@redhat.com> | 2011-03-11 11:06:20 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-03-14 23:18:39 +0100 |
commit | ebaca041565c1b81a16b1e7e743e56050b0158b6 (patch) | |
tree | b0010204d481f8206b4fe37ac4d7037a475cb9b9 | |
parent | bfb0f6643325937698e5b185cd1a0da1923e385f (diff) | |
download | linuxquota-ebaca041565c1b81a16b1e7e743e56050b0158b6.tar.gz |
Fix ddquot buffer leak
The ddquot buffer is used to tranfer data from/to file. All its data are
copied from/to it, so it's not needed after return from qtree_read_dquot()/
qtree_write_dquot().
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | quotaio_tree.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/quotaio_tree.c b/quotaio_tree.c index cdc0e8f..9f87889 100644 --- a/quotaio_tree.c +++ b/quotaio_tree.c @@ -272,6 +272,7 @@ void qtree_write_dquot(struct dquot *dquot) lseek(dquot->dq_h->qh_fd, dquot->dq_dqb.u.v2_mdqb.dqb_off, SEEK_SET); info->dqi_ops->mem2disk_dqblk(ddquot, dquot); ret = write(dquot->dq_h->qh_fd, ddquot, info->dqi_entry_size); + free(ddquot); if (ret != info->dqi_entry_size) { if (ret > 0) errno = ENOSPC; @@ -421,11 +422,13 @@ struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id) if (ret != info->dqi_entry_size) { if (ret > 0) errno = EIO; + free(ddquot); die(2, _("Cannot read quota structure for id %u: %s\n"), dquot->dq_id, strerror(errno)); } info->dqi_ops->disk2mem_dqblk(dquot, ddquot); } + free(ddquot); return dquot; } |