GUACAMOLE-1263: Merge mark freed memory as freed prior to calling rfbClientCleanup().

This commit is contained in:
Virtually Nick 2021-01-15 14:51:36 -05:00 committed by GitHub
commit c769d18cf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,12 +77,27 @@ int guac_vnc_client_free_handler(guac_client* client) {
/* Wait for client thread to finish */ /* Wait for client thread to finish */
pthread_join(vnc_client->client_thread, NULL); pthread_join(vnc_client->client_thread, NULL);
/* Free memory not free'd by libvncclient's rfbClientCleanup() */ /* Free memory that may not be free'd by libvncclient's
if (rfb_client->frameBuffer != NULL) free(rfb_client->frameBuffer); * rfbClientCleanup() prior to libvncclient 0.9.12 */
if (rfb_client->raw_buffer != NULL) free(rfb_client->raw_buffer);
if (rfb_client->rcSource != NULL) free(rfb_client->rcSource); if (rfb_client->frameBuffer != NULL) {
free(rfb_client->frameBuffer);
rfb_client->frameBuffer = NULL;
}
if (rfb_client->raw_buffer != NULL) {
free(rfb_client->raw_buffer);
rfb_client->raw_buffer = NULL;
}
if (rfb_client->rcSource != NULL) {
free(rfb_client->rcSource);
rfb_client->rcSource = NULL;
}
/* Free VNC rfbClientData linked list (may not be free'd by
* rfbClientCleanup(), depending on libvncclient version) */
/* Free VNC rfbClientData linked list (not free'd by rfbClientCleanup()) */
while (rfb_client->clientData != NULL) { while (rfb_client->clientData != NULL) {
rfbClientData* next = rfb_client->clientData->next; rfbClientData* next = rfb_client->clientData->next;
free(rfb_client->clientData); free(rfb_client->clientData);