[PATCH] staging: hv: fix a memory leak in adj_guesttime()

From: Haiyang Zhang
Date: Tue Jul 26 2011 - 14:56:50 EST


The allocated struct adj_time_work needs to be freed if we
are not using it.

Signed-off-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
Signed-off-by: K. Y. Srinivasan <kys@xxxxxxxxxxxxx>

---
drivers/staging/hv/hv_util.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c
index d3fb017..4fc1c98 100644
--- a/drivers/staging/hv/hv_util.c
+++ b/drivers/staging/hv/hv_util.c
@@ -157,7 +157,10 @@ static inline void adj_guesttime(u64 hosttime, u8 flags)
scnt--;
INIT_WORK(&wrk->work, hv_set_host_time);
schedule_work(&wrk->work);
+ return;
}
+
+ kfree(wrk);
}

/*
--
1.6.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/