提交 2b603dcb 编写于 作者: A Alex Jia 提交者: Eric Blake

console: plug memory leaks

Using 'virReallocN' to allocate memory on virConsoleEventOnStdin,
virConsoleEventOnStdout and virConsoleEventOnStream, however, the
cleanup function virConsoleShutdown hasn't released these memory.

* tools/console.c: fix memory leaks on virConsoleShutdown.

https://bugzilla.redhat.com/show_bug.cgi?id=767488Signed-off-by: NAlex Jia <ajia@redhat.com>
上级 5abbe04d
/* /*
* console.c: A dumb serial console client * console.c: A dumb serial console client
* *
* Copyright (C) 2007, 2008, 2010 Red Hat, Inc. * Copyright (C) 2007-2008, 2010-2011 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -101,6 +101,8 @@ virConsoleShutdown(virConsolePtr con) ...@@ -101,6 +101,8 @@ virConsoleShutdown(virConsolePtr con)
virStreamAbort(con->st); virStreamAbort(con->st);
virStreamFree(con->st); virStreamFree(con->st);
} }
VIR_FREE(con->streamToTerminal.data);
VIR_FREE(con->terminalToStream.data);
if (con->stdinWatch != -1) if (con->stdinWatch != -1)
virEventRemoveHandle(con->stdinWatch); virEventRemoveHandle(con->stdinWatch);
if (con->stdoutWatch != -1) if (con->stdoutWatch != -1)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册