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

[Xen-changelog] [qemu-xen-unstable] qemu-char: fix memory leak in qemu_char_open_pty()



commit e6af340b9e32e78fd980d46d939aa0939f51ebd4
Author:     Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx>
AuthorDate: Fri Mar 7 15:27:36 2014 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Oct 16 16:52:06 2015 +0100

    qemu-char: fix memory leak in qemu_char_open_pty()
    
    The momery pointed by s and chr could be leaked if openpty return a value
    less then 0.
    
    Signed-off-by: Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx>
    Coverity-IDs: 1055926 1055927
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 qemu-char.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 324ed16..f62a6af 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -932,6 +932,8 @@ static CharDriverState *qemu_chr_open_pty(void)
     s = qemu_mallocz(sizeof(PtyCharDriver));
 
     if (openpty(&s->fd, &slave_fd, pty_name, NULL, NULL) < 0) {
+        qemu_free(s);
+        qemu_free(chr);
         return NULL;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
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®.