[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] gnttab: Fix memory leak in failure path



From: david ambu <david.preetham@xxxxxxxxx>

In certain error paths, the context memory was not being released,
causing a potential memory leak. Ensure that __GnttabFree() is called
on failure to properly release resources and reset the context.
Free Context during failure paths
Allocated memory is freed during failure case.

Signed-off-by: david ambu <david.preetham@xxxxxxxxx>

Added blank line, split patch and improved commit message

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx>
---
 src/xenbus/gnttab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
index 693e9b3..ea95edf 100644
--- a/src/xenbus/gnttab.c
+++ b/src/xenbus/gnttab.c
@@ -1139,6 +1139,9 @@ GnttabInitialize(
 fail2:
     Error("fail2\n");
 
+    __GnttabFree(*Context);
+    *Context = NULL;
+
 fail1:
     Error("fail1 (%08x)\n", status);
 
-- 
2.50.1.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.