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

[xen staging] tools/xenstore-control: Don't leak buf in live_update_start()

commit 79b6574f8ecea39c14557bdd7049c7e2d21ddcbd
Author:     Julien Grall <jgrall@xxxxxxxxxx>
AuthorDate: Thu Feb 25 17:08:49 2021 +0000
Commit:     Julien Grall <jgrall@xxxxxxxxxx>
CommitDate: Fri Feb 26 09:46:36 2021 +0000

    tools/xenstore-control: Don't leak buf in live_update_start()
    All the error paths but one will free buf. Cover the remaining path so
    buf can't be leaked.
    This bug was discovered and resolved using Coverity Static Analysis
    Security Testing (SAST) by Synopsys, Inc.
    Fixes: 7f97193e6aa8 ("tools/xenstore: add live update command to 
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
 tools/xenstore/xenstore_control.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstore_control.c 
index f6f4626c06..548363ee70 100644
--- a/tools/xenstore/xenstore_control.c
+++ b/tools/xenstore/xenstore_control.c
@@ -44,8 +44,10 @@ static int live_update_start(struct xs_handle *xsh, bool 
force, unsigned int to)
         return 1;
     ret = strdup("BUSY");
-    if (!ret)
+    if (!ret) {
+        free(buf);
         return 1;
+    }
     for (time_start = time(NULL); time(NULL) - time_start < to;) {
generated by git-patchbot for /home/xen/git/xen.git#staging



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