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

[Xen-changelog] [xen master] mini-os: fix various memory leaks in netfront



commit 927c43c82b4af7347d667da5549503bb5af17b97
Author:     Matthew Daley <mattjd@xxxxxxxxx>
AuthorDate: Wed Sep 18 15:38:00 2013 +1200
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Sat Sep 21 16:42:20 2013 +0100

    mini-os: fix various memory leaks in netfront
    
    Coverity-ID: 1055832
    Coverity-ID: 1055833
    Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
    Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 extras/mini-os/netfront.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/extras/mini-os/netfront.c b/extras/mini-os/netfront.c
index a999985..3a5be64 100644
--- a/extras/mini-os/netfront.c
+++ b/extras/mini-os/netfront.c
@@ -506,7 +506,7 @@ int netfront_tap_open(char *nodename) {
 
 void shutdown_netfront(struct netfront_dev *dev)
 {
-    char* err = NULL;
+    char* err = NULL, *err2;
     XenbusState state;
 
     char path[strlen(dev->backend) + strlen("/state") + 1];
@@ -549,16 +549,21 @@ void shutdown_netfront(struct netfront_dev *dev)
 
 close:
     if (err) free(err);
-    xenbus_unwatch_path_token(XBT_NIL, path, path);
+    err2 = xenbus_unwatch_path_token(XBT_NIL, path, path);
+    if (err2) free(err2);
 
     snprintf(nodename, sizeof(nodename), "%s/tx-ring-ref", dev->nodename);
-    xenbus_rm(XBT_NIL, nodename);
+    err2 = xenbus_rm(XBT_NIL, nodename);
+    if (err2) free(err2);
     snprintf(nodename, sizeof(nodename), "%s/rx-ring-ref", dev->nodename);
-    xenbus_rm(XBT_NIL, nodename);
+    err2 = xenbus_rm(XBT_NIL, nodename);
+    if (err2) free(err2);
     snprintf(nodename, sizeof(nodename), "%s/event-channel", dev->nodename);
-    xenbus_rm(XBT_NIL, nodename);
+    err2 = xenbus_rm(XBT_NIL, nodename);
+    if (err2) free(err2);
     snprintf(nodename, sizeof(nodename), "%s/request-rx-copy", dev->nodename);
-    xenbus_rm(XBT_NIL, nodename);
+    err2 = xenbus_rm(XBT_NIL, nodename);
+    if (err2) free(err2);
 
     if (!err)
         free_netfront(dev);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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