[Spice-commits] server/reds.cpp
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 26 09:07:10 UTC 2020
server/reds.cpp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
New commits:
commit 4a34111711b59742f9f87f38d855acdd9eeaa7fc
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri Jun 26 09:06:53 2020 +0100
reds: Avoid a "end" label just to free password
"password" is pretty small, allocate on stack directly.
RSA is currently 1024 bits, that is more or less 128 bytes.
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Kevin Pouget <kpouget at redhat.com>
diff --git a/server/reds.cpp b/server/reds.cpp
index 3a27ce2b..fdce1fb0 100644
--- a/server/reds.cpp
+++ b/server/reds.cpp
@@ -2072,7 +2072,7 @@ static void reds_handle_ticket(void *opaque)
RSA_size(link->tiTicketing.rsa), SPICE_MAX_PASSWORD_LENGTH);
}
- password = g_new0(char, RSA_size(link->tiTicketing.rsa) + 1);
+ password = (char *) alloca(RSA_size(link->tiTicketing.rsa) + 1);
password_size = RSA_private_decrypt(link->tiTicketing.rsa_size,
link->tiTicketing.encrypted_ticket.encrypted_data,
(unsigned char *)password,
@@ -2110,14 +2110,11 @@ static void reds_handle_ticket(void *opaque)
}
reds_handle_link(link);
- goto end;
+ return;
error:
reds_send_link_result(link, SPICE_LINK_ERR_PERMISSION_DENIED);
reds_link_free(link);
-
-end:
- g_free(password);
}
static void reds_get_spice_ticket(RedLinkInfo *link)
More information about the Spice-commits
mailing list