]> xenbits.xensource.com Git - people/liuw/mini-os.git/commitdiff
mini-os: fix various memory leaks in various locations
authorMatthew Daley <mattjd@gmail.com>
Wed, 18 Sep 2013 03:38:03 +0000 (15:38 +1200)
committerIan Campbell <ian.campbell@citrix.com>
Sat, 21 Sep 2013 15:43:04 +0000 (16:43 +0100)
Coverity-ID: 1055827
Coverity-ID: 1055828
Coverity-ID: 1055829
Coverity-ID: 1055830
Coverity-ID: 1055831
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
kernel.c
lib/xs.c

index e9402b911d2d94ca350c2171c78e602553d0a0b6..24fa25c3ed9f041c9bffa4400125c9627bd6a17a 100644 (file)
--- a/kernel.c
+++ b/kernel.c
@@ -84,8 +84,10 @@ static void shutdown_thread(void *p)
         free(err);
         xenbus_wait_for_watch(&events);
     }
-    xenbus_unwatch_path_token(XBT_NIL, path, token);
-    xenbus_write(XBT_NIL, path, "");
+    err = xenbus_unwatch_path_token(XBT_NIL, path, token);
+    if (err) free(err);
+    err = xenbus_write(XBT_NIL, path, "");
+    if (err) free(err);
     printk("Shutting down (%s)\n", shutdown);
 
     if (!strcmp(shutdown, "poweroff"))
@@ -96,6 +98,7 @@ static void shutdown_thread(void *p)
         /* Unknown */
         shutdown_reason = SHUTDOWN_crash;
     app_shutdown(shutdown_reason);
+    free(shutdown);
 }
 #endif
 
index c603d178bf53f4740c7ca4d0dbccbce27eec3786..324bd05d329b0ad7b5b2256a64a7ebe7df231dc7 100644 (file)
--- a/lib/xs.c
+++ b/lib/xs.c
@@ -144,6 +144,7 @@ char **xs_directory(struct xs_handle *h, xs_transaction_t t,
     msg = xenbus_ls(t, path, &res);
     if (msg) {
        printk("xs_directory(%s): %s\n", path, msg);
+       free(msg);
        return NULL;
     }
 
@@ -163,6 +164,7 @@ char **xs_directory(struct xs_handle *h, xs_transaction_t t,
     }
 
     *num = n;
+    free(res);
     return entries;
 }