Skip to content

Commit

Permalink
vnc: fix memory leak
Browse files Browse the repository at this point in the history
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: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1437556133-11268-1-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
gongleiarei authored and bonzini committed Jul 24, 2015
1 parent 4bf1cb0 commit 6092845
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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:
Expand All @@ -2584,6 +2586,7 @@ static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
}
vnc_flush(vs);
vnc_client_error(vs);
qcrypto_cipher_free(cipher);
return 0;
}

Expand Down

0 comments on commit 6092845

Please sign in to comment.