提交 60928458 编写于 作者: G Gonglei 提交者: Paolo Bonzini

vnc: fix memory leak

If vnc's password is configured, it will leak memory
which cipher variable pointed on every vnc connection.

Cc: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
Signed-off-by: NGonglei <arei.gonglei@huawei.com>
Message-Id: <1437556133-11268-1-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 4bf1cb03
......@@ -2520,7 +2520,7 @@ static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
size_t i, pwlen;
unsigned char key[8];
time_t now = time(NULL);
QCryptoCipher *cipher;
QCryptoCipher *cipher = NULL;
Error *err = NULL;
if (!vs->vd->password) {
......@@ -2573,6 +2573,8 @@ static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
start_client_init(vs);
}
qcrypto_cipher_free(cipher);
return 0;
reject:
......@@ -2584,6 +2586,7 @@ reject:
}
vnc_flush(vs);
vnc_client_error(vs);
qcrypto_cipher_free(cipher);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册