[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 21/32] qemu-char: fix memory leak in qemu_char_open_pty()
From: Kaifeng Zhu <kaifeng.zhu@xxxxxxxxxx> 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 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@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |