All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: hv: fix a memory leak in adj_guesttime()
@ 2011-07-26 19:15 Haiyang Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: Haiyang Zhang @ 2011-07-26 19:15 UTC (permalink / raw)
  To: haiyangz, hjanssen, kys, v-abkane, gregkh, linux-kernel, devel,
	virtualization

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

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

---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] staging: hv: fix a memory leak in adj_guesttime()
@ 2011-07-26 19:15 Haiyang Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: Haiyang Zhang @ 2011-07-26 19:15 UTC (permalink / raw)
  To: haiyangz, hjanssen, kys, v-abkane, gregkh, linux-kernel, devel, vir

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

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

---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-26 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 19:15 [PATCH] staging: hv: fix a memory leak in adj_guesttime() Haiyang Zhang
  -- strict thread matches above, loose matches on Subject: below --
2011-07-26 19:15 Haiyang Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.