cluster/ec: Fix iobuf mem leak

iobuf_get and iobref_add implicitly
ref the iobuf.

Hence, it is necessary to unref iobuf
before setting it to NULL.

Change-Id: Icadd8925574cf04fe708d8090868e49356653a8e
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: http://review.gluster.org/9818
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
Raghavendra Talur 2015-03-06 13:26:30 +05:30 committed by Vijay Bellur
parent accd61fb64
commit da2f8d09de

View File

@ -900,9 +900,9 @@ int32_t ec_truncate_write(ec_fop_data_t * fop, uintptr_t mask)
vector.iov_base = iobuf->ptr;
vector.iov_len = fop->offset * ec->fragments - fop->user_size;
memset(vector.iov_base, 0, vector.iov_len);
memset(iobuf->ptr, 0, vector.iov_len);
iobuf_unref (iobuf);
iobuf = NULL;
ec_writev(fop->frame, fop->xl, mask, fop->minimum, NULL, NULL, fop->fd,