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

[PATCH 3/4] store: Fix memory leak in failure paths



In error paths in StoreTransactionStart and StoreWatchAdd, the
context structure was not being freed. Make sure all error paths
release resources by calling __StoreFree()

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

Improve commit message

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

diff --git a/src/xenbus/store.c b/src/xenbus/store.c
index 27e0706..39fd106 100644
--- a/src/xenbus/store.c
+++ b/src/xenbus/store.c
@@ -1629,14 +1629,15 @@ fail3:
     StoreFreeResponse(Response);
     ASSERT(IsZeroMemory(&Request, sizeof (XENBUS_STORE_REQUEST)));
 
+fail2:
+    Error("fail2\n");
+
     (*Transaction)->Caller = NULL;
     (*Transaction)->Magic = 0;
 
     ASSERT(IsZeroMemory(*Transaction, sizeof (XENBUS_STORE_TRANSACTION)));
     __StoreFree(*Transaction);
-
-fail2:
-    Error("fail2\n");
+    *Transaction = NULL;
 
 fail1:
     Error("fail1 (%08x)\n", status);
@@ -1849,6 +1850,7 @@ fail3:
 
     ASSERT(IsZeroMemory(*Watch, sizeof (XENBUS_STORE_WATCH)));
     __StoreFree(*Watch);
+    *Watch = NULL;
 
 fail2:
     Error("fail2\n");
-- 
2.50.1.windows.1




 


Rackspace

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