libjio: Fix a memory leak in jtrans_rollback()
commitb2e18b1fefc2b51baf70d5e1a5c41567214ebfe4
authorAlberto Bertogli <albertito@blitiri.com.ar>
Sat, 26 Feb 2011 21:47:21 +0000 (26 21:47 +0000)
committerAlberto Bertogli <albertito@blitiri.com.ar>
Sat, 26 Feb 2011 21:56:43 +0000 (26 21:56 +0000)
tree1c87682f449e8a1681a49d97789bad3612915033
parenta243dffae86f5524c1b49c63a7314e19ad8228bd
libjio: Fix a memory leak in jtrans_rollback()

jtrans_rollback() creates a new transaction using the data saved by
jtrans_commit() in op->pdata as the data to commit, which is stored in
op->buf, making both point to the same location.

After applying the new transaction, we need to free it; however, jtrans_free()
assumes op->buf points to a different place than op->pdata, and attempts to
free both. Thus, to prevent a double free in the hand-crafted transaction, we
need to set one of them to NULL.

However, we currently set both to NULL, effectively leaking the memory used to
store it.

This patch fixes that bug, by simply removing one of the two assignments.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
libjio/trans.c