From: Kaifeng Zhu <kaifeng....@citrix.com>

The momery pointed by s and chr could be leaked if openpty return a value
less then 0.

Signed-off-by: Kaifeng Zhu <kaifeng....@citrix.com>
Coverity-IDs: 1055926 1055927
Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>
---
 qemu-char.c |    2 ++
 1 file changed, 2 insertions(+)

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;
     }
 
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to