1448d9
diff -up tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx.zrle-crash tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx
1448d9
--- tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx.zrle-crash	2013-07-01 13:41:59.000000000 +0100
1448d9
+++ tigervnc-1.3.0/common/rfb/ZRLEEncoder.cxx	2013-12-12 17:30:48.510007365 +0000
1448d9
@@ -55,16 +55,19 @@ Encoder* ZRLEEncoder::create(SMsgWriter*
1448d9
 }
1448d9
 
1448d9
 ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer_)
1448d9
-  : writer(writer_), zos(0,0,zlibLevel)
1448d9
+  : writer(writer_)
1448d9
 {
1448d9
   if (sharedMos)
1448d9
     mos = sharedMos;
1448d9
   else
1448d9
     mos = new rdr::MemOutStream(129*1024);
1448d9
+
1448d9
+  zos = new rdr::ZlibOutStream(0, 0, zlibLevel);
1448d9
 }
1448d9
 
1448d9
 ZRLEEncoder::~ZRLEEncoder()
1448d9
 {
1448d9
+  delete zos;
1448d9
   if (!sharedMos)
1448d9
     delete mos;
1448d9
 }
1448d9
@@ -78,10 +81,10 @@ bool ZRLEEncoder::writeRect(const Rect&
1448d9
 
1448d9
   switch (writer->bpp()) {
1448d9
   case 8:
1448d9
-    wroteAll = zrleEncode8(r, mos, &zos, imageBuf, maxLen, actual, ig);
1448d9
+    wroteAll = zrleEncode8(r, mos, zos, imageBuf, maxLen, actual, ig);
1448d9
     break;
1448d9
   case 16:
1448d9
-    wroteAll = zrleEncode16(r, mos, &zos, imageBuf, maxLen, actual, ig);
1448d9
+    wroteAll = zrleEncode16(r, mos, zos, imageBuf, maxLen, actual, ig);
1448d9
     break;
1448d9
   case 32:
1448d9
     {
1448d9
@@ -94,16 +97,16 @@ bool ZRLEEncoder::writeRect(const Rect&
1448d9
       if ((fitsInLS3Bytes && pf.isLittleEndian()) ||
1448d9
           (fitsInMS3Bytes && pf.isBigEndian()))
1448d9
       {
1448d9
-        wroteAll = zrleEncode24A(r, mos, &zos, imageBuf, maxLen, actual, ig);
1448d9
+        wroteAll = zrleEncode24A(r, mos, zos, imageBuf, maxLen, actual, ig);
1448d9
       }
1448d9
       else if ((fitsInLS3Bytes && pf.isBigEndian()) ||
1448d9
                (fitsInMS3Bytes && pf.isLittleEndian()))
1448d9
       {
1448d9
-        wroteAll = zrleEncode24B(r, mos, &zos, imageBuf, maxLen, actual, ig);
1448d9
+        wroteAll = zrleEncode24B(r, mos, zos, imageBuf, maxLen, actual, ig);
1448d9
       }
1448d9
       else
1448d9
       {
1448d9
-        wroteAll = zrleEncode32(r, mos, &zos, imageBuf, maxLen, actual, ig);
1448d9
+        wroteAll = zrleEncode32(r, mos, zos, imageBuf, maxLen, actual, ig);
1448d9
       }
1448d9
       break;
1448d9
     }
1448d9
diff -up tigervnc-1.3.0/common/rfb/ZRLEEncoder.h.zrle-crash tigervnc-1.3.0/common/rfb/ZRLEEncoder.h
1448d9
--- tigervnc-1.3.0/common/rfb/ZRLEEncoder.h.zrle-crash	2013-07-01 13:42:01.000000000 +0100
1448d9
+++ tigervnc-1.3.0/common/rfb/ZRLEEncoder.h	2013-12-12 17:30:48.510007365 +0000
1448d9
@@ -45,7 +45,7 @@ namespace rfb {
1448d9
   private:
1448d9
     ZRLEEncoder(SMsgWriter* writer);
1448d9
     SMsgWriter* writer;
1448d9
-    rdr::ZlibOutStream zos;
1448d9
+    rdr::ZlibOutStream* zos;
1448d9
     rdr::MemOutStream* mos;
1448d9
     static rdr::MemOutStream* sharedMos;
1448d9
     static int maxLen;