Skip to content

Commit 0c023c2

Browse files
committed
libvncserver: null extension data after closing in rfbCloseClient
If the function 'close' points to does a free() _and_ checks for NULL (as is the case for rfbTightExtensionClientClose()), this prevents double free()s. If the function 'close' points to does not do a free(), nulling out the data after closing out should (semantically) not do harm. Closes #585
1 parent 3ea549b commit 0c023c2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/libvncserver/sockets.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,10 @@ rfbCloseClient(rfbClientPtr cl)
551551
rfbExtensionData* extension;
552552

553553
for(extension=cl->extensions; extension; extension=extension->next)
554-
if(extension->extension->close)
554+
if(extension->extension->close) {
555555
extension->extension->close(cl, extension->data);
556+
extension->data = NULL;
557+
}
556558

557559
LOCK(cl->updateMutex);
558560
#if defined(LIBVNCSERVER_HAVE_LIBPTHREAD) || defined(LIBVNCSERVER_HAVE_WIN32THREADS)

0 commit comments

Comments
 (0)