Commit dbfa4ad1 authored by runge's avatar runge

We seem to need to guard against freeing iterator 'i' twice in...

We seem to need to guard against freeing iterator 'i' twice in rfbSendFramebufferUpdate()  (italc reported bug)
parent 975b6902
...@@ -2631,7 +2631,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2631,7 +2631,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
rows = (h-1)/cl->correMaxHeight+1; rows = (h-1)/cl->correMaxHeight+1;
nUpdateRegionRects += rectsPerRow*rows; nUpdateRegionRects += rectsPerRow*rows;
} }
sraRgnReleaseIterator(i); sraRgnReleaseIterator(i); i=NULL;
} else if (cl->preferredEncoding == rfbEncodingUltra) { } else if (cl->preferredEncoding == rfbEncodingUltra) {
nUpdateRegionRects = 0; nUpdateRegionRects = 0;
...@@ -2645,7 +2645,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2645,7 +2645,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
rfbScaledCorrection(cl->screen, cl->scaledScreen, &x, &y, &w, &h, "rfbSendFramebufferUpdate"); rfbScaledCorrection(cl->screen, cl->scaledScreen, &x, &y, &w, &h, "rfbSendFramebufferUpdate");
nUpdateRegionRects += (((h-1) / (ULTRA_MAX_SIZE( w ) / w)) + 1); nUpdateRegionRects += (((h-1) / (ULTRA_MAX_SIZE( w ) / w)) + 1);
} }
sraRgnReleaseIterator(i); sraRgnReleaseIterator(i); i=NULL;
#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBZ
} else if (cl->preferredEncoding == rfbEncodingZlib) { } else if (cl->preferredEncoding == rfbEncodingZlib) {
nUpdateRegionRects = 0; nUpdateRegionRects = 0;
...@@ -2660,7 +2660,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2660,7 +2660,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
rfbScaledCorrection(cl->screen, cl->scaledScreen, &x, &y, &w, &h, "rfbSendFramebufferUpdate"); rfbScaledCorrection(cl->screen, cl->scaledScreen, &x, &y, &w, &h, "rfbSendFramebufferUpdate");
nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1); nUpdateRegionRects += (((h-1) / (ZLIB_MAX_SIZE( w ) / w)) + 1);
} }
sraRgnReleaseIterator(i); sraRgnReleaseIterator(i); i=NULL;
#ifdef LIBVNCSERVER_HAVE_LIBJPEG #ifdef LIBVNCSERVER_HAVE_LIBJPEG
} else if (cl->preferredEncoding == rfbEncodingTight) { } else if (cl->preferredEncoding == rfbEncodingTight) {
nUpdateRegionRects = 0; nUpdateRegionRects = 0;
...@@ -2681,7 +2681,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2681,7 +2681,7 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
} }
nUpdateRegionRects += n; nUpdateRegionRects += n;
} }
sraRgnReleaseIterator(i); sraRgnReleaseIterator(i); i=NULL;
#endif #endif
#endif #endif
} else { } else {
...@@ -2806,6 +2806,10 @@ rfbSendFramebufferUpdate(rfbClientPtr cl, ...@@ -2806,6 +2806,10 @@ rfbSendFramebufferUpdate(rfbClientPtr cl,
#endif #endif
} }
} }
if (i) {
sraRgnReleaseIterator(i);
i = NULL;
}
if ( nUpdateRegionRects == 0xFFFF && if ( nUpdateRegionRects == 0xFFFF &&
!rfbSendLastRectMarker(cl) ) !rfbSendLastRectMarker(cl) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment